create-atomic-agent
它能做什么
它介绍如何在 Atomic Agents Python 框架中设计并连接一个 AI 智能体,从输入和输出结构到服务商连接。适用于构建结构化 AI 智能体的开发者。
适用场景
- ✓当开发者想为 Atomic Agents 项目添加规划、路由或信息提取类智能体时。
- ✓当开发者想基于该框架构建一个简单的聊天智能体时。
- ✓当开发者需要一个返回结构化输出、供其他代码使用的智能体时。
技能链接
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-agent/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请构建一个 Atomic Agents 智能体,用来读取支持工单,并返回其类别和紧急程度。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能首先询问智能体应完成什么任务、使用哪些结构定义和哪家服务商,然后编写结构定义、系统提示词、客户端设置和智能体,并运行它以进行检查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Create an Atomic Agent
An agent is an LLM-backed transformer from one BaseIOSchema to another. Building one means: design the schemas, write the system prompt, wire the provider client, build the AgentConfig, instantiate AtomicAgent[In, Out].
For deep material (streaming, token counting, hooks, multi-agent memory), the authority is ../framework/references/agents.md plus providers.md, prompts.md, and memory.md. This skill is the action-oriented path: clarify → write → run.
When this fires vs the umbrella framework skill
- This skill: the user is creating or wiring a specific agent — "add a planner agent", "build a Q&A agent", "make a router that classifies tickets".
frameworkskill: questions about Atomic Agents in general, or the user is doing something other than authoring an agent.
Phase 1 — Clarify
Bundle into one message:
- What should the agent do? One sentence. Becomes the persona /
backgroundline. - Inputs and outputs. Use
BasicChatInputSchema/BasicChatOutputSchemafor free-form chat. Use a custom pair for anything structured (extraction, classification, planning, routing). When custom, branch to thecreate-atomic-schemaskill for the schema authoring. - Provider. OpenAI / Anthropic / Groq / Ollama / Gemini / OpenRouter / MiniMax. Default: whatever the project already uses; otherwise OpenAI.
- Conversational? Yes → wire a
ChatHistory. No (single-shot transformer) → omit it for stateless behavior. - Context providers. Anything to inject into the prompt at runtime (current time, user identity, retrieved docs)? If yes, plan to also use the
create-atomic-context-providerskill afterwards.
Skip anything already settled in context.
Phase 2 — Plan
State the plan in one short block:
- File:
<project>/agents/<agent_name>.py(or directly inmain.pyfor a tiny project — see../framework/references/project-structure.md). - Schemas: which pair, where they live.
- Provider + model + Instructor mode. Default models: OpenAI
gpt-5-mini, Anthropicclaude-haiku-4-5, Groqllama-3.3-70b-versatile, Ollamallama3.1, Geminigemini-2.5-flash. SystemPromptGeneratorcontent — three sections:background,steps,output_instructions.- History? Hooks? Context providers?
Phase 3 — Implement
Canonical imports (do not deviate)
from atomic_agents import (
AtomicAgent, AgentConfig,
BasicChatInputSchema, BasicChatOutputSchema,
)
from atomic_agents.context import ChatHistory, SystemPromptGenerator
from instructor import Mode
Wire the provider client (always Instructor-wrapped)
The full per-provider matrix lives in ../framework/references/providers.md. Quick recap:
# OpenAI — default mode is Mode.TOOLS
import os, instructor, openai
client = instructor.from_openai(openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]))
model = "gpt-5-mini"
api_params: dict = {}
# Anthropic — Mode.TOOLS, max_tokens REQUIRED in model_api_parameters
import anthropic
client = instructor.from_anthropic(anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]))
model = "claude-haiku-4-5"
api_params = {"max_tokens": 4096}
# Gemini — Mode.GENAI_TOOLS, assistant_role="model"
from google import genai
client = instructor.from_genai(genai.Client(api_key=os.environ["GEMINI_API_KEY"]), mode=Mode.GENAI_TOOLS)
model = "gemini-2.5-flash"
api_params = {}
# Groq / Ollama / MiniMax — Mode.JSON in both factory and AgentConfig
Build the agent
from atomic_agents import AtomicAgent, AgentConfig
from atomic_agents.context import ChatHistory, SystemPromptGenerator
agent = AtomicAgent[MyInput, MyOutput](
config=AgentConfig(
client=client,
model=model,
history=ChatHistory(), # omit for stateless
system_prompt_generator=SystemPromptGenerator(
background=["You are a concise research assistant."],
steps=[
"Read the question carefully.",
"Decide what minimum information answers it.",
"Produce the answer in the required schema.",
],
output_instructions=[
"Reply under 100 words.",
"If unsure, set status='error' and explain why.",
],
),
# Provider-specific knobs — match the Instructor factory
# mode=Mode.TOOLS, # OpenAI / Anthropic / OpenRouter
# mode=Mode.JSON,
常见问题
它支持多家 AI 服务商吗?
支持。该技能列出了 OpenAI、Anthropic、Groq、Ollama、Gemini、OpenRouter 和 MiniMax。
智能体总是需要自定义的结构定义吗?
不需要。对于自由形式的聊天,它使用框架自带的基础聊天结构定义。
结构定义是做什么用的?
它是带类型的约定,规定了输入智能体的内容和它输出的内容。
详情
作者的原始描述
Build and wire an `AtomicAgent[InSchema, OutSchema]` — schemas, `AgentConfig`, `SystemPromptGenerator`, provider client, history, hooks, optional context providers. Use when the user asks to "create an agent", "add another agent", "build an `AtomicAgent`", "wire up an agent", "make a planner/router/extractor agent", or runs `/atomic-agents:create-atomic-agent`.
repo: Eigenwise/atomic-agents
热度
- GitHub 星标
- 6.3k
- 排名
- #14237
- 许可证
- MIT
- 更新时间
- 2026/10/29
评论
- …
同一仓库的更多技能
create-atomic-context-provider
6.3k帮你的智能体为 Atomic Agents 智能体添加上下文提供者,使当前时间或检索到的文档等最新细节出现在其提示词中。
create-atomic-schema
6.3k帮你的智能体为 Atomic Agents 智能体和工具设计带类型的输入与输出结构定义,并附上清晰的字段说明。
create-atomic-tool
6.3k帮你的智能体为 Atomic Agents 应用构建一个带类型的工具,例如智能体可以调用的 API 封装或计算器。
framework
6.3k帮你的智能体正确使用 Atomic Agents Python 框架,涵盖结构定义、智能体、工具、提示词和服务商设置。