all publishers

ag2ai

@ag2ai source repo

90 published skills

  1. ▌
    Add Tool 2 · ag2ai
    Add a properly typed and registered tool function to an existing AG2 agent setup. Generates the function with schema, type annotations, and correct registration on both caller and executor agents.
    252 repo stars
  2. ▌
    Build Group Chat 2 · ag2ai
    Build an AG2 handoff-driven workflow with DefaultPattern, agent handoffs, context variables, and routing. Use when the user wants customer service routing, state-machine workflows, or explicit agent-to-agent transitions.
    252 repo stars
  3. ▌
    Ag2 Hitl 2 · ag2ai
    Pause an AG2 beta `Agent` mid-run to collect human input via `context.input()`, or gate a tool call with `approval_required()` middleware. Use when the user wants the agent to ask for confirmation, request missing info (passwords, API keys, data), or have a human approve sensitive / irreversible / expensive tool calls (sending emails, deleting records, payments).
    252 repo stars
  4. ▌
    Ag2 Ag UI 2 · ag2ai
    Expose an AG2 beta `Agent` over the AG-UI protocol so a frontend (CopilotKit, custom React/Next.js, or any AG-UI client) can stream responses, render tool calls, sync shared state, and surface human-input checkpoints. Wraps the agent with `AGUIStream(agent)` and mounts it in FastAPI via `stream.dispatch(...)` or `stream.build_asgi()`. Use when the user wants a web frontend in front of an AG2 agent rather than a CLI / script.
    252 repo stars
  5. ▌
    Ag2 Testing 2 · ag2ai
    Test AG2 beta agents and tools without hitting a real LLM provider. Pass `TestConfig(...)` from `autogen.beta.testing` as the agent's config (or per-`ask`) to mock LLM responses, inject `ToolCallEvent`s to simulate tool execution, and assert success / error paths. Use when the user is writing pytest tests for an Agent or Tool.
    252 repo stars
  6. ▌
    Ag2 Overview 2 · ag2ai
    Map of AG2 beta capabilities and which sibling skill to reach for. Load first when the user mentions building with AG2 beta (autogen.beta) but the specific feature isn't yet clear — agents, tools, model config, delegation, memory, observers, structured output, HITL, AG-UI, telemetry, or testing.
    252 repo stars
  7. ▌
    Ag2 Telemetry 2 · ag2ai
    Add OpenTelemetry traces to an AG2 beta `Agent` via `TelemetryMiddleware` (`autogen.beta.middleware.builtin`). Emits spans for the full turn, each LLM call, each tool execution, and each human-input request, following the OpenTelemetry GenAI semantic conventions. Compatible with any OTLP backend — Jaeger, Grafana Tempo, Datadog, Honeycomb, Langfuse. Use when the user wants production-grade traces, latency analysis, token-usage attribution, or to ship telemetry into an existing observability stack.
    252 repo stars
  8. ▌
    Ag2 Middleware 2 · ag2ai bundle
    Middleware
    252 repo stars
  9. ▌
    Ag2 Quickstart 2 · ag2ai bundle
    Build a minimal AG2 beta `Agent` end to end — pick a model provider, set a prompt, call `agent.ask()`, then continue the conversation with `reply.ask()` (multi-turn). Use when the user is starting a new AG2 beta project, has no working `Agent` yet, or needs the multi-turn chaining pattern. Covers `OpenAIConfig`, `AnthropicConfig`, `GeminiConfig`, `OllamaConfig` etc., and env-var fallback for API keys.
    252 repo stars
  10. ▌
    Ag2 Shell Tool 2 · ag2ai
    Give an AG2 beta `Agent` the ability to run shell commands. Covers `LocalShellTool` (client-side `subprocess`, works with any provider) and the provider-native `ShellTool` (Anthropic / OpenAI execution). Use when the user wants the Agent to execute commands, build/test code, manage files, or operate on a workspace. Always pair with sandboxing — `allowed`, `blocked`, `ignore`, or `readonly`.
    252 repo stars
  11. ▌
    Ag2 Add Custom Tool 2 · ag2ai bundle
    Add a custom Python tool to an AG2 beta `Agent` using the `@tool` decorator. Use when the user wants to give an Agent a new capability backed by Python code (API calls, DB queries, computations, file ops). Covers sync and async tools, parameter typing, Pydantic schema customisation, returning typed `Input` / `ToolResult` (text / data / images / binary), `final=True` early-exit, and dependency injection via `Context` / `Inject` / `Variable` / `Depends`.
    252 repo stars
  12. ▌
    Ag2 Multimodal Input 2 · ag2ai
    Send images, audio, video, or documents into an AG2 beta `Agent` alongside text. Pass `ImageInput`, `AudioInput`, `VideoInput`, or `DocumentInput` as positional args to `agent.ask(...)`. Use when the user wants the agent to process non-text input — describe a photo, transcribe audio, summarise a PDF, analyse a video. Covers per-provider support matrix, the four ways to source data (URL / path / bytes / file_id), Gemini-specific YouTube + media-resolution + clipping, OpenAI image-detail, Anthropic prompt-caching on attachments, and `FilesAPI` for upload lifecycle.
    252 repo stars
  13. ▌
    Ag2 Structured Output 2 · ag2ai bundle
    Get a typed Python value back from an AG2 beta `Agent` instead of free text. Pass `response_schema=` (a Pydantic model, dataclass, primitive, union, `ResponseSchema`, or `@response_schema` validator) and read the parsed result via `await reply.content()`. Use when the user wants validated structured output, classification, extraction, or scoring. Covers `ResponseSchema`, `@response_schema`, `PromptedSchema` (for providers without native structured output), per-turn override, validation retries, and primitive embedding.
    252 repo stars
  14. ▌
    Ag2 Use Builtin Tools 2 · ag2ai bundle
    Wire AG2 beta's shipped tools into an `Agent` — both provider-native server-side tools (web search, web fetch, code execution, MCP, image generation, memory) and locally-executed common toolkits (filesystem, DuckDuckGo, Exa, Tavily, skills). Use when the user wants capabilities AG2 already ships rather than writing custom Python. For shell commands see `ag2-shell-tool`; for custom Python tools see `ag2-add-custom-tool`.
    252 repo stars
  15. ▌
    Ag2 Subagent Delegation 2 · ag2ai bundle
    Delegate work from one AG2 beta `Agent` to another. Two patterns — auto-injected `run_subtask` / `run_subtasks(parallel=True)` (opt in via `tasks=TaskConfig(...)`) for self-delegation and parallel fan-out, and `Agent.as_tool()` for named delegates between distinct agents. Use when one coordinator should spawn sub-tasks, fan out concurrent work, or hand off to a specialist agent. Covers context flow, recursion safety, and `persistent_stream` for sub-task history.
    252 repo stars
  16. ▌
    Ag2 Knowledge And Memory 2 · ag2ai bundle
    Persist agent state across runs, shape what the LLM sees per turn, and cap history to fit a context window. Covers `KnowledgeStore` (memory / sqlite / disk / redis), `KnowledgeConfig` (`store=`, `compact=`, `aggregate=`, `bootstrap=`), aggregation strategies (`WorkingMemoryAggregate`, `ConversationSummaryAggregate`), assembly policies (`WorkingMemoryPolicy`, `EpisodicMemoryPolicy`, `ConversationPolicy`, `SlidingWindowPolicy`, `TokenBudgetPolicy`, `AlertPolicy`), and compaction (`TailWindowCompact`, `SummarizeCompact`). Use when the user wants the agent to remember between conversations, manage long histories, or control prompt assembly.
    252 repo stars
  17. ▌
    Ag2 Observers And Alerts 2 · ag2ai bundle
    Monitor an AG2 beta agent's stream — log events, detect repeated tool calls, track token spend, build trigger-driven observers, route observer alerts to the model, and halt on FATAL conditions. Covers `@observer(...)` (stateless), `BaseObserver` (stateful), built-ins (`TokenMonitor`, `LoopDetector`), `Watch` primitives (`EventWatch`, `CadenceWatch`, `DelayWatch`, `IntervalWatch`, `CronWatch`, `AllOf`, `AnyOf`, `Sequence`), `ObserverAlert` (`Severity.INFO/WARNING/CRITICAL/FATAL`), `AlertPolicy`, and `HaltEvent`. Use when the user wants observability, runtime safety guards, alerts, or batch/time-based reactive logic.
    252 repo stars
  18. ▌
    PDF Tools · ag2ai
    Use when the user wants to read, summarise, extract text/tables from, split, merge, or fill a PDF. Explains when to read a PDF visually vs. extract its text, and how to manipulate PDFs via code execution.
    252 repo stars
  19. ▌
    Web Research · ag2ai
    Use when the user asks you to research a topic, fact-check a claim, compare options, or gather current information from the web. Guides thorough, multi-source research using the search and web-fetch tools.
    252 repo stars
  20. ▌
    Email Drafting · ag2ai
    Use when the user asks you to write or reply to an email or message. Produces a ready-to-send draft in their voice, matching their learned tone and formatting preferences.
    252 repo stars
  21. ▌
    Self Knowledge · ag2ai
    Use when the user asks what you can do, whether you can do a specific thing (make images, run something on a schedule, read a folder, reach their email), how to make you do it, where in the app to change a setting, or why you can't access something. Covers your own capabilities, the Settings pages, and how folders, personas, and memory are scoped.
    252 repo stars
  22. ▌
    Dev Workflow · ag2ai
    Use when setting up the FastStream dev environment, running tests/linters/static analysis, managing docker brokers, or preparing a PR.
    252 repo stars
  23. ▌
    Testing Patterns · ag2ai
    Choosing which tests to run after a change, or writing tests under tests/ — base testcases, markers, in-memory vs connected brokers.
    252 repo stars
  24. ▌
    Code Architecture · ag2ai
    Use when writing or modifying FastStream library source code under faststream/ — package layout, broker package anatomy, typing rules, configs, and public API conventions.
    252 repo stars
  25. ▌
    Documentation Writing · ag2ai
    Use when writing or editing documentation under docs/ — page layout, docs_src snippet embedding, snippet tests, link conventions, and FastStream example-code rules.
    252 repo stars
  26. ▌
    New Tool · ag2ai
    Create a new tool function for an AG2 agent. Generates properly typed, documented tool functions with JSON return contracts and error handling.
    252 repo stars
  27. ▌
    New Agent · ag2ai
    Scaffold a new AG2 ConversableAgent with tool functions and LLM config. Use when creating a standalone agent that needs tools, a system prompt, and proper structure.
    252 repo stars
  28. ▌
    Connector Tool · ag2ai
    Create tool functions that integrate with external APIs and connectors (Slack, GitHub, Microsoft Graph, databases, etc.). Handles authentication, pagination, and rate limiting.
    252 repo stars
  29. ▌
    New A2a Agent · ag2ai
    Scaffold a new A2A (Agent-to-Agent) compliant agent with server wiring, card settings, and skill definitions. Use for agents that will be deployed as A2A services.
    252 repo stars
  30. ▌
    Group Chat · ag2ai
    Create a multi-agent group chat using DefaultPattern with explicit handoffs. Use when you need deterministic control over agent transitions, pipelines with validation gates, hierarchical delegation, or context-aware routing between specialists.
    252 repo stars
  31. ▌
    Nested Chat · ag2ai
    Create a nested chat workflow where a multi-step pipeline is encapsulated inside a single agent. Use when you want to package a sequence of agent interactions (research, draft, edit) into one agent that runs the pipeline automatically when triggered.
    252 repo stars
  32. ▌
    Two Agent Chat · ag2ai
    Create a simple two-agent chat where two agents converse back and forth. The simplest multi-agent pattern -- use for iterative refinement, Q&A, debate, or any task where two roles alternate.
    252 repo stars
  33. ▌
    Sequential Chat · ag2ai
    Create a sequential chat workflow where an initiator agent runs through a queue of chats in order. Use for step-by-step pipelines like outline -> plan -> format, where each stage builds on the previous output.
    252 repo stars
  34. ▌
    Ag2 Brand Guidelines · ag2ai bundle
    Applies AG2's official design system and brand guidelines to all generated code, artifacts, UI components, and visual output. Use this skill whenever building web pages, landing pages, dashboards, product UIs, React components, HTML artifacts, presentations, or any visual output that should follow AG2's brand identity. Always activate this skill when the user mentions AG2 brand, design system, brand colors, typography, visual consistency, component styling, or wants any UI to look like AG2's product. Even if the user doesn't explicitly say "brand guidelines," use this skill for any AG2-related visual work. Also activate for **campaign landing pages**, marketing / product-announcement pages, or any request where the user supplies campaign content (headline, stats, problem, how-it-works, features, CTA) and asks for a full page — use the canonical 9-section light-mode pattern in references/page-templates/campaign-landing.md.
    252 repo stars
  35. ▌
    Ag2 Chat Fundamentals · ag2ai
    Core AG2 conventions that apply to all agent patterns -- LLMConfig, ending chats, agent types, and common APIs. Loaded automatically when building any AG2 workflow.
    252 repo stars
  36. ▌
    Group Chat Auto Pattern · ag2ai
    Create a multi-agent group chat using AutoPattern (no handoffs). The Group Chat Manager selects agents automatically based on their descriptions. Use when conversation flow is unpredictable or defining explicit routing rules would be overly complex.
    252 repo stars
  37. ▌
    Add Guardrails · ag2ai
    Add safety guardrails to AG2 agents using LLMGuardrail and RegexGuardrail. Use when the user wants to enforce safety constraints, filter PII, or redirect off-topic responses.
    252 repo stars
  38. ▌
    Build RAG Agent · ag2ai
    Build a Retrieval-Augmented Generation (RAG) agent using AG2's RetrieveUserProxyAgent with vector database support. Use when the user wants agents that can query documents or knowledge bases.
    252 repo stars
  39. ▌
    Create Agent Team · ag2ai
    Scaffold a complete AG2 multi-agent team with agents, tools, group chat configuration, and an entry point. Use when the user wants to create a new multi-agent workflow from scratch.
    252 repo stars
  40. ▌
    Add Code Execution · ag2ai
    Add code execution capability to AG2 agents using LocalCommandLineCodeExecutor or Docker. Use when the user wants agents that can write and run Python code.
    252 repo stars
  41. ▌
    Debug Conversation · ag2ai
    Analyze AG2 agent conversation logs and code to diagnose issues like wrong speaker selection, tool call failures, infinite loops, or unexpected termination.
    252 repo stars
  42. ▌
    Add MCP Integration · ag2ai
    Wire a Model Context Protocol (MCP) server into AG2 agents using create_toolkit. Use when the user wants to connect external tools via MCP.
    252 repo stars
  43. ▌
    Build Research Agent · ag2ai
    Build a complete web research agent team using AG2 with search tools, web crawling, and structured output. Use when the user wants a practical research or information-gathering workflow.
    252 repo stars
  44. ▌
    Build Reasoning Agent · ag2ai
    Build an AG2 ReasoningAgent that uses tree-of-thought reasoning with beam search, MCTS, or LATS strategies. Use when the user needs advanced reasoning for complex problem solving.
    252 repo stars
  45. ▌
    Calculator · ag2ai bundle
    Evaluate arithmetic expressions using a sandboxed Python script.
    252 repo stars
  46. ▌
    Ag2 Imports · ag2ai
    Correct import paths and module structure for the AG2 framework
    252 repo stars
  47. ▌
    Add Tool · ag2ai
    How to create and register a tool on an AG2 agent
    252 repo stars
  48. ▌
    Ag2 Architect · ag2ai
    An agent that helps design multi-agent systems using the AG2 framework
    252 repo stars
  49. ▌
    Agent Patterns · ag2ai
    Patterns for creating and configuring AG2 agents correctly
    252 repo stars
  50. ▌
    Explain Flow · ag2ai
    Trace and explain message flow in a multi-agent AG2 conversation
    252 repo stars
  51. ▌
    Build Group Chat · ag2ai
    Step-by-step workflow for building an AG2 multi-agent group chat
    252 repo stars
  52. ▌
    Fastapi Endpoint Patterns · ag2ai
    Conventions for writing FastAPI endpoints with proper typing, status codes, and error handling
    252 repo stars
  53. ▌
    Fastapi Project Structure · ag2ai
    Standard directory layout and module organization for FastAPI applications
    252 repo stars
  54. ▌
    Add Crud Endpoint · ag2ai
    Step-by-step workflow for adding a new CRUD endpoint to a FastAPI application
    252 repo stars
  55. ▌
    Use Github Tools · ag2ai
    Connect AG2 agents to GitHub via MCP for repository, issue, and code search operations
    252 repo stars
  56. ▌
    Run Eval · ag2ai
    How to run the Agent Eval Benchmark dataset with ag2 test eval
    252 repo stars
  57. ▌
    Review Process · ag2ai
    How the Code Reviewer agent conducts systematic code reviews with prioritized findings
    252 repo stars
  58. ▌
    Integrate Web Search · ag2ai
    Register and use web search tools with AG2 agents to search the web and extract page content
    252 repo stars
  59. ▌
    Add Agent To Team · ag2ai
    Step-by-step guide to add a new agent to the multi-agent team
    252 repo stars
  60. ▌
    Research Methodology · ag2ai
    How the Research Analyst agent conducts research, evaluates sources, and produces structured reports
    252 repo stars
  61. ▌
    API Conventions · ag2ai
    REST and WebSocket endpoint patterns, error handling, and Pydantic schema conventions for the backend
    252 repo stars
  62. ▌
    Add API Endpoint · ag2ai
    Step-by-step guide to add a new REST or WebSocket endpoint to the backend
    252 repo stars
  63. ▌
    Add Frontend Page · ag2ai
    Step-by-step guide to add a new page or component to the React frontend
    252 repo stars
  64. ▌
    Fullstack Architecture · ag2ai
    Architecture, directory layout, communication protocol, and conventions for the full-stack multi-agent application
    252 repo stars
  65. ▌
    Ag2 Acp · ag2ai
    Drive external CLI coding agents (Claude Code, Codex, OpenCode) as first-class AG2 Agents over the Agent Client Protocol (ACP): point an Agent at a ClaudeCodeConfig / CodexConfig / OpenCodeConfig preset from ag2.acp and ask()/run() it like any agent, with its thinking, tool calls, plans and permission prompts externalized onto AG2's event stream. Use when orchestrating, observing, or gating CLI coding agents from Python — permission_policy ask/auto/deny HITL gating, fs_root confinement, turn timeouts, in-process testing via fake_acp_config. To expose an AG2 agent to other systems instead, see ag2-a2a or ag2-mcp; for approval plumbing see ag2-hitl.
    252 repo stars
  66. ▌
    Ag2 MCP · ag2ai
    Host an MCP server that exposes an AG2 `Agent` (plus prompts and resources) to MCP clients like Claude Desktop, Cursor, or the MCP Inspector. Wrap the agent with `MCPServer(agent)` — it surfaces `Agent.ask()` as a single conversational tool and serves over stdio (`run_stdio()`) or streamable HTTP (it is itself an ASGI app for uvicorn). Covers `MCPServer`, `SessionConfig` (multi-turn history), `Prompt`/`PromptArgument`/`PromptMessage`, `Resource`/`ResourceTemplate`, `AskContext`/`ContextProvider` (per-request injection), `build_ask_tool`, OAuth2 `security=`, and in-process `testing.connect`/`testing.serve` helpers. Use when you want OTHER MCP clients to call YOUR agent. This is the SERVER side — for CONSUMING external MCP servers from an agent (client side) see `ag2-use-builtin-tools` (`MCPServerTool`).
    252 repo stars
  67. ▌
    Ag2 Hitl · ag2ai
    Pause an AG2 `Agent` mid-run to collect human input via `context.input()`, or gate a tool call with `approval_required()` middleware. Use when the user wants the agent to ask for confirmation, request missing info (passwords, API keys, data), or have a human approve sensitive / irreversible / expensive tool calls (sending emails, deleting records, payments).
    252 repo stars
  68. ▌
    Ag2 Live · ag2ai
    Build realtime voice / live audio agents with AG2's `ag2.live` module. Wrap a prompt + provider config in `LiveAgent` and open a bidirectional voice session with `agent.run()`, pumping mic audio in and playing synthesized speech out. Covers the two realtime providers — Gemini Live (`GeminiRealTimeConfig`) and OpenAI Realtime (`OpenAIRealTimeConfig`) with audio/text output modalities, voices, and user-speech transcription; audio I/O over the local sound card (`SoundDeviceRecorder` / `SoundDevicePlayer`, both sounddevice-backed); one-shot speech-to-text (`OpenAITranscriber`, `OpenAITranslationTranscriber`) and its `.pipe(agent)` voice pipeline; text-to-speech (`OpenAITTSConfig`); and `TTSObserver`, which speaks a regular text `Agent`'s streamed tokens aloud. Use when the user wants a talking agent, a phone/voice assistant, live transcription, or to add TTS playback to a text agent.
    252 repo stars
  69. ▌
    Ag2 Ag UI · ag2ai
    Expose an AG2 `Agent` over the AG-UI protocol so a frontend (CopilotKit, custom React/Next.js, or any AG-UI client) can stream responses (text and reasoning), render tool calls, sync shared state, and track sub-task steps. Wraps the agent with `AGUIStream(agent)` and mounts it in FastAPI via `stream.dispatch(...)` or `stream.build_asgi()`. Use when the user wants a web frontend in front of an AG2 agent rather than a CLI / script.
    252 repo stars
  70. ▌
    Ag2 Testing · ag2ai
    Test AG2 agents and tools without hitting a real LLM provider. Pass `TestConfig(...)` from `ag2.testing` as the agent's config (or per-`ask`) to mock LLM responses, inject `ToolCallEvent`s to simulate tool execution, and assert success / error paths. Use when the user is writing pytest tests for an Agent or Tool.
    252 repo stars
  71. ▌
    Ag2 Overview · ag2ai
    Map of AG2 capabilities and which sibling skill to reach for. Load first when the user mentions building with AG2 (ag2) but the specific feature isn't yet clear — agents, tools, model config, delegation, memory, observers, structured output, HITL, AG-UI, MCP server hosting, A2A protocol, realtime voice, telemetry, testing, or evaluation.
    252 repo stars
  72. ▌
    Ag2 Telemetry · ag2ai
    Add OpenTelemetry traces to an AG2 `Agent` via `TelemetryMiddleware` (`ag2.middleware.builtin`). Emits spans for the full turn, each LLM call, each tool execution, and each human-input request, following the OpenTelemetry GenAI semantic conventions. Compatible with any OTLP backend — Jaeger, Grafana Tempo, Datadog, Honeycomb, Langfuse. Use when the user wants production-grade traces, latency analysis, token-usage attribution, or to ship telemetry into an existing observability stack.
    252 repo stars
  73. ▌
    Ag2 Evaluation · ag2ai
    Evaluate, test, and track an AG2 Agent offline. Build a Suite of tasks, run the agent with run_agent, and grade answers with prebuilt scorers (final_answer_matches, tool_called, no_tool_errors, token_budget) or a custom @scorer — including the agent_judge LLM judge. Read the RunResult scorecard (pass_rate, score_stats, value_counts), gate it in CI with deterministic TestConfig cassettes, persist to store_dir and diff runs to catch regressions, and grade existing traces with evaluate_traces. Use when the user wants to evaluate, test, grade, or benchmark an agent, build a CI or regression gate, or score correctness, tool use, cost, or quality. To compare builds head-to-head or on a leaderboard, see ag2-eval-comparison.
    252 repo stars
  74. ▌
    Ag2 Middleware · ag2ai bundle
    Intercept the AG2 agent loop with `BaseMiddleware` — wrap full turns (`on_turn`), each LLM call (`on_llm_call`), each tool execution (`on_tool_execution`), or each human-input request (`on_human_input`). Use for retry, logging, history trimming, request mutation, tool auditing, guardrails, or rate limiting. Built-ins: `LoggingMiddleware`, `RetryMiddleware`, `HistoryLimiter`, `TokenLimiter`, `TelemetryMiddleware` (see `ag2-telemetry`). For per-tool hooks see also `ag2-add-custom-tool` tool-middleware section.
    252 repo stars
  75. ▌
    Ag2 Quickstart · ag2ai bundle
    Build a minimal AG2 `Agent` end to end — pick a model provider, set a prompt, call `agent.ask()`, then continue the conversation with `reply.ask()` (multi-turn). Use when the user is starting a new AG2 project, has no working `Agent` yet, or needs the multi-turn chaining pattern. Covers `OpenAIConfig`, `AnthropicConfig`, `GeminiConfig`, `OllamaConfig` etc., and env-var fallback for API keys.
    252 repo stars
  76. ▌
    Ag2 Shell Tool · ag2ai
    Give an AG2 `Agent` the ability to run shell commands. Covers `SandboxShellTool` (client-side `subprocess` via `LocalEnvironment`, works with any provider) and the provider-native `ShellTool` (OpenAI Responses execution). Use when the user wants the Agent to execute commands, build/test code, manage files, or operate on a workspace. Always pair with sandboxing — `allowed`, `blocked`, `ignore`, or `readonly`.
    252 repo stars
  77. ▌
    Ag2 Add Custom Tool · ag2ai bundle
    Add a custom Python tool to an AG2 `Agent` using the `@tool` decorator. Use when the user wants to give an Agent a new capability backed by Python code (API calls, DB queries, computations, file ops). Covers sync and async tools, parameter typing, Pydantic schema customisation, returning typed `Input` / `ToolResult` (text / data / images / binary), `final=True` early-exit, and dependency injection via `Context` / `Inject` / `Variable` / `Depends`.
    252 repo stars
  78. ▌
    Ag2 Eval Comparison · ag2ai
    Compare AG2 agents, models, or prompts to decide which is better. run_variants scores several named agents on one suite and ranks them on a leaderboard (Variants holds a mapping of named Agent instances plus an axis label). run_pairwise with pairwise_judge does head-to-head LLM comparison using a dual-order position swap (a win counts only if it survives the swap, else a tie), reporting win-rate with a Wilson 95% CI, wins, losses, ties, flips, and agreement (Cohen's kappa). human_pairwise collects a person's blinded vote inline, or via an exported manifest with export_pairwise_cases and human_labels. Use when the user wants to A/B test prompts or models, run a leaderboard, pick a winner, judge head-to-head, measure win-rate, or collect human preference labels. For running and grading a single agent, see ag2-evaluation.
    252 repo stars
  79. ▌
    Ag2 Multimodal Input · ag2ai
    Send images, audio, video, or documents into an AG2 `Agent` alongside text. Pass `ImageInput`, `AudioInput`, `VideoInput`, or `DocumentInput` as positional args to `agent.ask(...)`. Use when the user wants the agent to process non-text input — describe a photo, transcribe audio, summarise a PDF, analyse a video. Covers per-provider support matrix, the four ways to source data (URL / path / bytes / file_id), Gemini-specific YouTube + media-resolution + clipping, OpenAI image-detail, Anthropic prompt-caching on attachments, and `FilesAPI` for upload lifecycle.
    252 repo stars
  80. ▌
    Ag2 Network Workflow · ag2ai
    Build an AG2 network `workflow` channel — the orchestrated N-party adapter driven by a declarative `TransitionGraph`. Use when the user needs conditional handoffs, multi-step pipelines, context-aware routing, feedback loops, or is migrating from the classic `GroupChat` + `Agent.handoffs` pattern. Covers `TransitionGraph`; factories `TransitionGraph.sequence(...)` / `.round_robin(...)`; built-in targets (`AgentTarget`, `RoundRobinTarget`, `StayTarget`, `RevertToInitiatorTarget`, `TerminateTarget`); built-in conditions (`Always`, `FromSpeaker`, `ToolCalled`, `ContextEquals`); the typed `Handoff` return for dynamic routing; channel-scoped context via `set_context`; `register_target` / `register_condition` for custom subclasses; the packet execution model and idempotent-tool requirement; eight cookbook patterns (pipeline, hierarchical, escalation, feedback loop, triage, and more); and side-by-side migration from classic `GroupChat`. Load this after `ag2-network-quickstart`.
    252 repo stars
  81. ▌
    Ag2 Structured Output · ag2ai bundle
    Get a typed Python value back from an AG2 `Agent` instead of free text. Pass `response_schema=` (a Pydantic model, dataclass, primitive, union, `ResponseSchema`, or `@response_schema` validator) and read the parsed result via `await reply.content()`. Use when the user wants validated structured output, classification, extraction, or scoring. Covers `ResponseSchema`, `@response_schema`, `PromptedSchema` (for providers without native structured output), per-turn override, validation retries, and primitive embedding.
    252 repo stars
  82. ▌
    Ag2 Use Builtin Tools · ag2ai bundle
    Wire AG2's shipped tools into an `Agent` — both provider-native server-side tools (web search, web fetch, code execution, MCP, image generation, memory) and locally-executed common toolkits (filesystem, DuckDuckGo, Exa, Tavily, skills). Use when the user wants capabilities AG2 already ships rather than writing custom Python. For shell commands see `ag2-shell-tool`; for custom Python tools see `ag2-add-custom-tool`.
    252 repo stars
  83. ▌
    Ag2 Network Discussion · ag2ai
    Open an AG2 network `discussion` channel — N-party (2+) round-robin where each participant speaks in fixed order, cycling until explicit close or TTL. Use when the user wants a brainstorm with a fixed cast, a panel discussion, or round-robin reviewers. Covers `agent_client.open(type="discussion", target=[...], knobs={"ordering": ORDERING_ROUND_ROBIN})`, the `expected_next_speaker` rotation, the `hc.can_send(...)` probe pattern (default handlers skip LLM calls when it isn't their turn), `DiscussionState`, the `turn_within` expectation defaults (`warn` at 120s / `hide` at 600s), view-window sizing for N participants, and the four close patterns that work with this adapter. Load this after `ag2-network-quickstart`. For conditional handoffs or declarative orchestration, see `ag2-network-workflow` instead.
    252 repo stars
  84. ▌
    Ag2 Network Governance · ag2ai
    Govern an AG2 multi-agent network — identity (`Passport`, `Resume`), per-agent `Rule` with two top-level blocks `access` (`AccessBlock`) and `limits` (`LimitsBlock`, which nests `RateBlock` + `InboxBlock`), the swappable `HubArbiter` / `RuleBasedArbiter` access-&-routing seam, `AuthAdapter` / `AuthRegistry` registration, channel-level `Expectation`s with `audit` / `notify_channel` / `auto_close` violation handlers, the hub's append-only audit log and `AUDIT_KIND_*` constants, live `HubListener` / `BaseHubListener` observability plus `Hub` `on_*` hooks and `register_sweeper`, and task observation via `agent.task(...)` + `TaskMirror` (updates `Resume.observed` for peer ranking). Use when the user needs rate limits, access policy, SLAs, compliance trails, live metrics/alerting, capability-driven peer ranking, or to inspect what actually happened on the network. Load this after `ag2-network-quickstart`. For the agent-side surface (custom handlers, views, LLM tools, `HumanClient`) see `ag2-network-tools-and-views`
    252 repo stars
  85. ▌
    Ag2 Network Quickstart · ag2ai
    Build a multi-agent AG2 network — load this whenever two or more `Agent`s need to interact. The network is the standard multi-agent pattern in `ag2`. Covers `Hub.open`, `LocalLink`, `HubClient.register`, `Passport`, `Resume`, channel lifecycle (PENDING → ACTIVE → CLOSING → CLOSED), the two 2-party channel adapters (`consulting` for strict 1Q1R and `conversation` for free-form), the `Envelope` wire format, audience routing, `wait_for_channel_event`, WAL replay via `hub.read_wal`, and the five channel-close routes. Entry point — routes to `ag2-network-discussion` (N-party round-robin), `ag2-network-workflow` (declarative orchestration / GroupChat migration), `ag2-network-governance` (rules / expectations / audit), or `ag2-network-tools-and-views` (custom handlers / peer discovery) for deeper needs.
    252 repo stars
  86. ▌
    Ag2 Subagent Delegation · ag2ai bundle
    Single-agent recursion and parallel fan-out within one AG2 `Agent` — auto-injected `run_subtask` / `run_subtasks(parallel=True)` (opt in via `tasks=TaskConfig(...)`) for self-delegation, and `Agent.as_tool()` as a lightweight no-hub way to call one named agent from inside another. Use when a single coordinator wants to break work into its own sub-tasks, fan out concurrent sub-tasks, or invoke a specialist agent as a tool. Covers context flow, recursion safety, and `persistent_stream` for sub-task history. **For two or more agents actually collaborating with a registry, durable channels, governance, or turn-taking, use `ag2-network-quickstart` instead** — the network is the standard multi-agent pattern in AG2.
    252 repo stars
  87. ▌
    Ag2 Knowledge And Memory · ag2ai bundle
    Persist agent state across runs, shape what the LLM sees per turn, and cap history to fit a context window. Covers `KnowledgeStore` (memory / sqlite / disk / redis), `KnowledgeConfig` (`store=`, `expose_tool=`, `write_event_log=`, `compact=`, `aggregate=`, `bootstrap=`) and its opt-out flags, aggregation strategies (`WorkingMemoryAggregate` with `prompt=` override, `ConversationSummaryAggregate`), assembly policies (`WorkingMemoryPolicy`, `EpisodicMemoryPolicy`, `ConversationPolicy`, `SlidingWindowPolicy`, `TokenBudgetPolicy`, `AlertPolicy`), compaction (`TailWindowCompact`, `SummarizeCompact`), and the lifecycle events (`AggregationStarted/Failed`, `CompactionStarted/Failed`, `EventLogFailed`). Use when the user wants the agent to remember between conversations, manage long histories, or control prompt assembly.
    252 repo stars
  88. ▌
    Ag2 Observers And Alerts · ag2ai bundle
    Monitor an AG2 agent's stream — log events, detect repeated tool calls, track token spend, build trigger-driven observers, route observer alerts to the model, and halt on FATAL conditions. Covers `@observer(...)` (stateless), `BaseObserver` (stateful), built-ins (`TokenMonitor`, `LoopDetector`), `Watch` primitives (`EventWatch`, `CadenceWatch`, `DelayWatch`, `IntervalWatch`, `CronWatch`, `AllOf`, `AnyOf`, `Sequence`), `ObserverAlert` (`Severity.INFO/WARNING/CRITICAL/FATAL`), `AlertPolicy`, and `HaltEvent`. Use when the user wants observability, runtime safety guards, alerts, or batch/time-based reactive logic.
    252 repo stars
  89. ▌
    Ag2 Network Tools And Views · ag2ai
    Shape what an AG2 network agent perceives and which actions its LLM can take. Covers the five auto-injected LLM-facing tools that ship via `NetworkPlugin` (`delegate`, `peers`, `channels`, `tasks`, `context`) plus the adapter-owned `say`; replacing the default handler with `agent_client.on_envelope(callback)` (gateways, headless workers); the `ViewPolicy` Protocol with the built-in `FullTranscript`, `WindowedSummary(recent_n=N)`, and `NamedWindowedSummary(recent_n=N)` views plus how to write a custom view; peer discovery via skill markdown (`skill_md=`, `parse_skill_frontmatter`, `hub.set_skill`); the `Envelope` wire format with the `EV_*` event taxonomy (`EV_TEXT`, `EV_PACKET`, `EV_CHANNEL_*`, `EV_EXPECTATION_VIOLATED`, `EV_TASK_CANCEL_REQUEST`, `EV_TASK_CANCELLED`), `audience` and `visible_to` semantics, `Priority`, `causation_id`, and how to send raw envelopes with custom event types via `agent_client.send_envelope(...)`. Use when the user wants to customise the LLM's network surface, write a custom envelo
    252 repo stars
  90. ▌
    Ag2 A2a · ag2ai
    Expose an AG2 `Agent` over the Agent-to-Agent (A2A) protocol so any A2A-compliant client (or another AG2 agent) can call it across process/host boundaries. Wrap the agent with `A2AServer(agent)` and serve it via `build_jsonrpc(...)`, `build_rest(...)`, or `build_grpc(...)` — each returns a ready-to-serve ASGI/gRPC object that publishes an A2A `AgentCard` (built by `build_card`) at `/.well-known/agent-card.json`. Use when you want an AG2 agent reachable as a standard networked A2A service — interop with non-AG2 A2A clients, multi-transport (JSON-RPC / REST / gRPC) endpoints, declared auth schemes, push notifications, or multi-tenancy. To consume a remote A2A agent from AG2 instead, point an `Agent` at `A2AConfig(card_url=...)`. Covers `A2AConfig`, `A2AServer`, `build_card`, security schemes (`bearer_scheme`/`api_key_scheme`/`oauth2_scheme`/`require`), and the in-process `testing.py` helpers (`make_test_client_factory`, `make_test_rest_client_factory`).
    252 repo stars