R0U5's picture
Upload README.md with huggingface_hub
4f8462f verified
|
Raw History Blame Contribute Delete
8.64 kB
metadata
license: mit
tags:
  - agentic-workflows
  - llm-agents
  - prompt-engineering
  - tool-use
  - function-calling
  - agent-security
  - prompt-injection
  - synthetic-data
  - preference-data
  - dpo
  - rlhf
  - instruction-tuning
language:
  - en
size_categories:
  - 1K<n<10K
task_categories:
  - text-generation
  - question-answering
task_ids:
  - text2text-generation
  - dialogue-modeling
pretty_name: Agentic Workflows 6K
dataset_info:
  features:
    - name: question
      dtype: string
    - name: chosen
      dtype: string
  splits:
    - name: train
      num_examples: 6000
  downloads: 0
configs:
  - config_name: default
    data_files:
      - split: train
        path: agentic_workflows_6k.parquet

Agentic Workflows 6K Dataset

A high-quality preference dataset of 6,000 question-answer pairs covering agentic workflows, LLM agent design patterns, tool/function calling, prompt engineering, and agent security. Designed for DPO/RLHF training, instruction tuning, and agent capability evaluation.

πŸ“Š Dataset Overview

Property Value
Examples 6,000
Format Parquet (question + chosen response)
Language English
License MIT
Task Preference learning, Instruction tuning, Agent training
Size ~47.6 KB (compressed)

🎯 Use Cases

  • DPO / RLHF Training: Preference pairs for aligning models to agentic behavior
  • Instruction Tuning: High-quality Q&A for teaching agent workflows
  • Agent Benchmarking: Evaluate model capability on agent design questions
  • Synthetic Data Generation: Seed for generating more agentic training data
  • RAG / Few-shot: Reference implementations for agent patterns

πŸ“‹ Data Structure

Each example contains two fields:

{
  "question": "How do I protect my AI agent from prompt injection attacks where malicious content in the environment tries to hijack the agent?",
  "chosen": "## Agent Security: Defending Against Prompt Injection\n\n### The Threat Model\n\nPrompt injection is unique to agents because agents process untrusted content (web pages, emails, files) as part of their operation..."
}
  • question (string): A practical question about agentic workflows, agent design, tool use, or agent security
  • chosen (string): A comprehensive, well-structured markdown response with code examples, threat models, best practices, and actionable guidance

🧠 Topic Coverage

The dataset spans agentic workflow domains:

Category Example Topics
Agent Security Prompt injection defense, sandboxing, tool permissions, data exfiltration prevention
Tool/Function Design Schema design, error handling, composition patterns, parallel execution, retry logic
Prompt Engineering System prompts, few-shot examples, chain-of-thought, ReAct, Plan-and-Execute
Memory & State Conversation history, long-term memory, context windows, retrieval-augmented agents
Multi-Agent Systems Orchestration, delegation, communication protocols, consensus mechanisms
Evaluation & Observability Tracing, metrics, eval frameworks, debugging agent failures
Production Patterns Rate limiting, cost optimization, fallbacks, human-in-the-loop, gradual rollout

πŸ’‘ Example Questions

  • "What are the best patterns for designing LLM tools/functions? I want to avoid common mistakes that make agents fail."
  • "How do I protect my AI agent from prompt injection attacks where malicious content in the environment tries to hijack the agent?"
  • "What's the recommended approach for handling tool failures gracefully in an agent loop?"
  • "How should I structure system prompts for multi-step agent workflows?"
  • "What are the tradeoffs between ReAct and Plan-and-Execute agent architectures?"

πŸš€ Quick Start

Load with Hugging Face datasets

from datasets import load_dataset

# Load the dataset
dataset = load_dataset("R0U5/agentic_workflows_6k", split="train")

# Inspect
print(dataset[0])
# {'question': 'How do I protect my AI agent from prompt injection...', 
#  'chosen': '## Agent Security: Defending Against Prompt Injection...'}

# Convert to preference format for DPO
def format_for_dpo(example):
    return {
        "prompt": example["question"],
        "chosen": example["chosen"],
        "rejected": ""  # Add your rejected responses here
    }

dpo_dataset = dataset.map(format_for_dpo)

Load with Pandas

import pandas as pd

df = pd.read_parquet("hf://datasets/R0U5/agentic_workflows_6k/agentic_workflows_6k.parquet")
print(df.head())
print(f"Total examples: {len(df)}")

πŸ”§ Training Example: DPO with TRL

from trl import DPOTrainer
from transformers import AutoModelForCausalLM, AutoTokenizer
from datasets import load_dataset

model = AutoModelForCausalLM.from_pretrained("your-base-model")
tokenizer = AutoTokenizer.from_pretrained("your-base-model")
tokenizer.pad_token = tokenizer.eos_token

dataset = load_dataset("R0U5/agentic_workflows_6k", split="train")

# Format for DPO (requires rejected responses - generate or curate)
def format_dpo(example):
    return {
        "prompt": example["question"],
        "chosen": example["chosen"],
        "rejected": generate_rejected(example["question"])  # Your method
    }

train_dataset = dataset.map(format_dpo)

trainer = DPOTrainer(
    model=model,
    args=TrainingArguments(
        output_dir="./agent-dpo",
        per_device_train_batch_size=4,
        num_train_epochs=3,
        learning_rate=5e-7,
    ),
    train_dataset=train_dataset,
    tokenizer=tokenizer,
)

trainer.train()

πŸ“ˆ Dataset Statistics

Examples: 6,000
Avg question length: ~150 chars
Avg response length: ~2,500 chars
Total tokens (est): ~15M
Format: Markdown with code blocks, headers, lists

πŸ—οΈ Data Generation

This dataset was created through a curated synthetic generation pipeline:

  1. Seed topics collected from agent development forums, GitHub issues, technical blogs
  2. Question generation using diverse prompt templates covering all major agentic workflow categories
  3. Response generation with high-quality models instructed to produce comprehensive, structured markdown
  4. Quality filtering for completeness, accuracy, code correctness, and formatting consistency
  5. Deduplication and near-dedup removal

βš–οΈ License

MIT License β€” Free for commercial and research use.

MIT License

Copyright (c) 2024 R0U5

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ“š Citation

If you use this dataset in your research, please cite:

@misc{agentic_workflows_6k,
  title={Agentic Workflows 6K: A Preference Dataset for LLM Agent Training},
  author={R0U5},
  year={2024},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/R0U5/agentic_workflows_6k},
  note={MIT License}
}

πŸ”— Related Resources

πŸ™‹ Support

  • Issues: GitHub Issues (or HF Discussions tab)
  • Questions: Open a Discussion on this dataset page

Dataset created as part of the Electric Sheep project β€” self-improving agentic systems research.