Logo de Openai Agentkit

Openai Agentkit

Comunidade
frankxai
openai-agentkit

Build production multi-agent systems with OpenAI AgentKit and the Agents SDK — orchestration, handoffs, and routines. Use when writing agents against OpenAI's AgentKit/Agents SDK or porting an agent design to the OpenAI stack.

Visão geral

Publicado porfrankxai
Repositórioclaude-skills-library
Nome da habilidadeopenai-agentkit
Estrelas
47
Forks
6
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por frankxai no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Openai Agentkit no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/frankxai/claude-skills-library/tree/main/free-skills/openai-agentkit
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/frankxai/claude-skills-library.git /tmp/claude-skills-library
mkdir -p .claude/skills
cp -r /tmp/claude-skills-library/free-skills/openai-agentkit .claude/skills/openai-agentkit
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Openai Agentkit em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Openai Agentkit automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Openai Agentkit não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

OpenAI AgentKit Expert Skill

Purpose

This skill provides comprehensive guidance on building production-ready multi-agent systems using OpenAI's AgentKit platform and Agents SDK, following 2025 best practices.

Platform Overview

OpenAI AgentKit (2025)

Complete platform for building, deploying, and optimizing agents with enterprise-grade tooling.

Core Components:

  • Agent Builder - Visual canvas for creating and versioning multi-agent workflows
  • Connector Registry - Central management for data and tool connections
  • ChatKit - Embeddable customizable chat-based agent experiences
  • Evaluation Suite - Datasets, trace grading, automated prompt optimization
  • Multi-Model Support - Third-party model integration capabilities

Agents SDK (Production-Ready)

The Agents SDK is the production evolution of the experimental Swarm framework. Use Agents SDK for all production work - Swarm is educational only.

Migration Note: If you encounter legacy Swarm code, migrate to Agents SDK immediately.

Core Concepts

1. Agents

An Agent encapsulates:

  • A set of instructions (system prompt)
  • A set of functions/tools
  • The capability to hand off execution to another Agent

Design Principle: Agents should be lightweight and specialized rather than monolithic and general-purpose.

2. Routines

A routine is a sequence of actions an agent can perform:

  • Natural language instructions (via system prompt)
  • Available tools needed to execute
  • Context and state management
  • Success criteria

Think of it as: A mini-workflow that an agent owns and executes autonomously.

3. Handoffs

Handoffs enable agent-to-agent transitions in execution flow.

Key Pattern: When an agent encounters a task outside its specialization, it hands off to a more appropriate agent.

Example:

python
# Triage agent determines which specialist to use
if task.type == "refund":
    handoff_to(refund_agent)
elif task.type == "sales":
    handoff_to(sales_agent)

Architectural Patterns

Pattern 1: Triage Pattern

Use Case: Routing requests to specialized sub-agents

Structure:

User Request → Triage Agent → [Determines Category] → Specialist Agent

Example Implementation:

python
# Triage agent with handoff capabilities
triage_agent = Agent(
    name="Customer Service Triage",
    instructions="Analyze customer requests and route to appropriate specialist",
    functions=[analyze_request],
    handoffs=[refund_agent, sales_agent, support_agent]
)

When to Use:

  • Multiple distinct capability domains
  • Clear categorization logic
  • Different agents need different tools/context

Pattern 2: Sequential Orchestration

Use Case: Multi-step workflows where each step has a specialist

Structure:

Step 1 Agent → [Complete] → Handoff → Step 2 Agent → ... → Final Agent

Example:

python
# Research → Analysis → Report Generation pipeline
research_agent → analysis_agent → report_agent

When to Use:

  • Clear sequential dependencies
  • Each step requires specialized expertise
  • Output of one step feeds the next

Pattern 3: Parallel Decomposition

Use Case: Breaking complex tasks into parallel subtasks

Structure:

Coordinator Agent
    ↓
    ├─→ Subtask Agent 1
    ├─→ Subtask Agent 2
    └─→ Subtask Agent 3
    ↓
Synthesis Agent (combines results)

When to Use:

  • Independent subtasks can run concurrently
  • Need to aggregate multiple perspectives
  • Performance optimization through parallelization

Best Practices

Agent Design

DO: ✅ Keep agents focused on single responsibilities ✅ Provide clear, specific instructions in system prompts ✅ Define explicit handoff conditions ✅ Use descriptive agent names (helps with debugging) ✅ Test agents in isolation before integration

DON'T: ❌ Create monolithic "do-everything" agents ❌ Allow agents to communicate directly (use handoffs) ❌ Over-engineer with too many specialized agents ❌ Ignore error handling in handoffs ❌ Skip agent boundary testing

Routine Design

Effective Routines:

  • Have clear entry and exit conditions
  • Include error handling paths
  • Specify required context/state
  • Document expected inputs/outputs
  • Define success metrics

Example:

python
routine = {
    "name": "Process Refund",
    "entry": "User requests refund",
    "steps": [
        "Verify order exists",
        "Check refund eligibility",
        "Calculate refund amount",
        "Process payment reversal",
        "Send confirmation"
    ],
    "exit": "Refund confirmed or rejection reason provided",
    "error_handling": "Escalate to human agent if verification fails"
}

Handoff Design

Critical Elements:

  • Clear Trigger Conditions - When should handoff occur?
  • Context Passing - What information transfers?
  • Return Path - Can control return to originating agent?
  • Failure Handling - What if target agent unavailable?

Example:

python
def handoff_condition(state):
    """Determine if handoff needed"""
    if state.requires_specialized_knowledge:
        return specialist_agent
    if state.exceeds_authority_level:
        return supervisor_agent
    return None  # Continue with current agent

Performance Optimization

Minimize LLM Calls

Principle: Frameworks that limit LLM involvement and rely on predefined or direct execution flows operate more efficiently.

Strategies:

  • Use deterministic logic where possible
  • Cache common responses
  • Batch similar requests
  • Pre-compute decision trees
  • Use smaller models for simple tasks

Efficient Tool Use

Principle: Give agents only the tools they need for their specialty.

Pattern:

python
# Specialized agents get targeted toolsets
refund_agent.tools = [verify_order, calculate_refund, process_payment]
sales_agent.tools = [check_inventory, create_quote, process_order]
# NOT: both agents get all 6 tools

Latency Reduction

  • Prefer single-agent solutions when possible
  • Use async operations for I/O-bound tasks
  • Implement request coalescing
  • Monitor and optimize hot paths

Common Anti-Patterns

1. Over-Decomposition

Problem: Too many agents for simple tasks creates overhead

Solution: Start simple, add agents only when complexity demands it

2. Circular Handoffs

Problem: Agent A → Agent B → Agent A creates loops

Solution: Design clear hierarchy or state-based termination

3. Stateless Agents

Problem: Agents lose context across handoffs

Solution: Implement proper state management and context passing

4. Unclear Boundaries

Problem: Overlapping agent responsibilities cause conflicts

Solution: Define explicit agent domains and decision criteria

Evaluation & Testing

Key Metrics

Agent-Level:

  • Task completion rate
  • Average response time
  • Tool usage efficiency
  • Handoff accuracy

System-Level:

  • End-to-end success rate
  • Total latency
  • Cost per interaction
  • User satisfaction scores

Testing Strategy

Unit Testing:

python
# Test individual agent behaviors
def test_refund_agent():
    result = refund_agent.process(valid_refund_request)
    assert result.status == "approved"
    assert result.amount > 0

Integration Testing:

python
# Test agent handoffs
def test_triage_to_refund():
    initial_state = {"request": "I want a refund"}
    final_state = orchestrator.run(initial_state)
    assert final_state.handling_agent == "refund_agent"
    assert final_state.completed == True

End-to-End Testing:

python
# Test full user journeys
def test_customer_journey():
    scenarios = load_test_scenarios()
    for scenario in scenarios:
        result = system.execute(scenario)
        assert result.meets_requirements()

Production Deployment

Monitoring

Essential Observability:

  • Agent invocation traces
  • Handoff decision logs
  • Tool call success rates
  • Error patterns and frequencies
  • Latency distributions

Tools:

  • AgentKit built-in evaluation suite
  • Custom logging to centralized system
  • Real-time alerting on failures
  • Performance dashboards

Security

Agent Security:

  • Scope tools to minimum required permissions
  • Validate all tool inputs
  • Sanitize user inputs before agent processing
  • Implement rate limiting per agent
  • Audit trail for all agent actions

Data Protection:

  • Never expose sensitive data in prompts unnecessarily
  • Use secure credential management
  • Encrypt state/context storage
  • Implement PII detection and masking

Scaling Strategies

Horizontal Scaling:

  • Deploy agent instances across multiple servers
  • Use load balancing for agent requests
  • Implement agent pools for high-volume scenarios

Vertical Optimization:

  • Profile and optimize slow agents
  • Use caching strategically
  • Batch similar requests
  • Upgrade to more powerful models selectively

Code Examples

Basic Agent Structure

python
from openai import OpenAI

client = OpenAI()

# Define specialized agent
support_agent = {
    "name": "Technical Support Agent",
    "model": "gpt-4o",
    "instructions": """You are a technical support specialist.
    Help users troubleshoot technical issues.
    If issue requires refund, hand off to refund agent.
    If issue is sales-related, hand off to sales agent.""",
    "tools": [
        {"type": "function", "function": troubleshooting_guide},
        {"type": "function", "function": escalate_to_human}
    ]
}

Handoff Implementation

python
def execute_agent_workflow(initial_request):
    current_agent = triage_agent
    context = {"request": initial_request, "history": []}

    while not is_complete(context):
        # Execute current agent
        response = client.chat.completions.create(
            model=current_agent.model,
            messages=build_messages(context, current_agent),
            tools=current_agent.tools
        )

        # Check for handoff
        next_agent = determine_handoff(response)
        if next_agent:
            context["history"].append({
                "from": current_agent.name,
                "to": next_agent.name
            })
            current_agent = next_agent
        else:
            context["result"] = response
            break

    return context

Integration with Other Systems

With Claude SDK

Use AgentKit for OpenAI-based workflows, Claude SDK for Anthropic-based workflows, and MCP to bridge data sources to both.

With LangGraph

LangGraph provides more fine-grained control flow. Use AgentKit for simpler workflows, LangGraph for complex state machines.

With MCP

AgentKit agents can consume MCP servers as tools, standardizing data source connections.

Migration Guide

From Swarm to Agents SDK

Key Changes:

  1. Replace swarm.run() with Agents SDK orchestration
  2. Update agent definitions to new schema
  3. Migrate handoff logic to production patterns
  4. Add proper error handling
  5. Implement monitoring and observability

Timeline: Swarm is maintenance-only. Migrate all production code by Q2 2025.

Decision Framework

Use OpenAI AgentKit when:

  • Building on OpenAI models (GPT-4, etc.)
  • Need visual agent builder for non-technical stakeholders
  • Want integrated evaluation and monitoring
  • Prefer managed platform over open-source frameworks

Consider alternatives when:

  • Need model flexibility (use LangGraph)
  • Require complex state machines (use LangGraph)
  • Want full control over orchestration (use custom solution)
  • Working with Anthropic models (use Claude SDK)

Resources

Official Documentation:

Community:

  • OpenAI Developer Forum
  • AgentKit Discord
  • GitHub Discussions

Final Principles

  1. Simplicity First - Start with single agents, add complexity only when needed
  2. Specialization Over Generalization - Focused agents perform better
  3. Explicit Handoffs - Clear routing beats implicit behavior
  4. Production-Ready - Use Agents SDK, not Swarm, for real applications
  5. Measure Everything - Observability is critical for multi-agent systems

This skill ensures you build robust, scalable, production-ready multi-agent systems using OpenAI's latest platform capabilities in 2025.

Perguntas frequentes

O que a habilidade de IA Openai Agentkit faz?

Build production multi-agent systems with OpenAI AgentKit and the Agents SDK — orchestration, handoffs, and routines. Use when writing agents against OpenAI's AgentKit/Agents SDK or porting an agent design to the OpenAI stack.

Por que usar Openai Agentkit no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Openai Agentkit é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Openai Agentkit no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/frankxai/claude-skills-library/tree/main/free-skills/openai-agentkit. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Openai Agentkit?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Openai Agentkit?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Openai Agentkit com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Openai Agentkit é gratuita?

Sim. A habilidade é publicada no GitHub por frankxai sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇