Token导航 LogoToken导航

Agent Skill · 研究检索

pydantic-ai-agent(pydantic AI Agent 搜索)

pydantic-ai-agent 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

pydantic-ai-agent 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 58,252。

总安装 419周安装 18GitHub Stars 公开资料未说明下载 147核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pydantic-ai-agent(pydantic AI Agent 搜索)
来源仓库:https://github.com/randomstar/skill-set
仓库路径:skills/pydantic-ai-agent
安装命令:
npx skills add https://github.com/randomstar/skill-set --skill pydantic-ai-agent
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/randomstar/skill-set --skill pydantic-ai-agent

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息。pydantic-ai-agent 属于研究检索类 Skill,可作为该场景下的辅助能力补充。适合根据关键词或任务场景快速定位候选结果。可结合来源仓库与原始 README 进一步核验具体用法。安装前需确认权限范围及是否会触发联网或文件读写操作。

建议检查维护状态,避免使用不稳定或已弃用的技能。

来源仓库内路径:skills/pydantic-ai-agent

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/randomstar/skill-set --skill pydantic-ai-agent;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

pydantic-ai-agent 怎么安装?

在终端执行 npx skills add https://github.com/randomstar/skill-set --skill pydantic-ai-agent。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

pydantic-ai-agent 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

pydantic-ai-agent 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

pydantic-ai-agent 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

pydantic-ai-agent 用的人多吗?

公开数据是累计安装 419 次,近一周安装 18 次,下载 147 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

pydantic-ai-agent 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
pydantic-ai-agent

pydantic AI Agent 搜索 · 本页

419—接触敏感数据MIT未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Pydantic AI Agent Builder

Build production-grade AI agents using Pydantic AI with a layered architectural pattern.

When to Use This Skill

Use this skill when building:

  • AI agents with tool/function calling capabilities
  • Conversational agents with state management
  • Streaming chat applications (SSE, real-time responses)
  • Multi-provider LLM applications (OpenAI, Anthropic, Google, Ollama)
  • FastAPI web services with AI agents
  • CLI applications with AI agents
  • Agents requiring dependency injection for tools

Quick Start

1. Scaffold a New Project

python scripts/scaffold_agent.py my_agent
cd my_agent
pip install -r requirements.txt

Options:

  • --minimal - Core files only
  • --web - Include FastAPI example
  • --cli - Include CLI example

2. Configure Provider

# .env file
LLM_PROVIDER=anthropic
LLM_MODEL_NAME=claude-3-5-sonnet-20241022
LLM_API_KEY=sk-ant-...

3. Run Examples

# CLI
python example_cli.py

# Web service
python example_fastapi.py
# Visit http://localhost:8000/docs

Architecture Overview

This pattern uses a layered architecture:

Router/CLI → Service → AgentFactory → Agent
                ↓           ↓
            Tools ← ToolRegistry
                ↓
            StateStore

Key Components:

  • AgentFactory - Creates configured agents (Factory pattern)
  • AgentService - Orchestrates agent lifecycle
  • ToolRegistry - Centralized tool registration
  • ToolCollection - Dependency injection for tools
  • AgentState - Conversation history management
  • StateStore - State persistence
  • ModelProvider - Multi-provider abstraction

Core Patterns

1. Agent Factory Pattern

Create agents with different configurations:

from agent_factory import agent_factory, AgentType

# Use default configuration
agent = agent_factory.create_agent(
    agent_type=AgentType.GENERAL,
    model=model,
    tools=tools,
    state=state
)

# Register custom configuration
agent_factory.register_config(AgentConfig(
    agent_type=AgentType.SPECIALIZED,
    system_prompt="You are a specialized assistant...",
    tool_names=["tool1", "tool2"],  # Filter tools
    model_settings={"temperature": 0.0}
))

2. Tool Registration

Register tools with metadata:

from tool_registry import tool_registry, ToolCategory

@tool_registry.register(
    name="search_database",
    category=ToolCategory.DATA,
    description="Search the database for records",
    requires_approval=False,
    tags={"database", "search"}
)
async def search_database(query: str) -> str:
    """Search database with query"""
    return f"Results for: {query}"

3. Dependency Injection

Tools with service dependencies:

# Define tool with service parameter
@tool_registry.register(...)
async def query_db(db_service: DatabaseService, query: str) -> str:
    """Query database (db_service injected automatically)"""
    return await db_service.execute(query)

# ToolCollection binds the service
@dataclass
class ToolCollection:
    database_service: DatabaseService

    def get_all_tools(self):
        # Automatically binds db_service to tools
        # LLM only sees: query_db(query: str)
        return self._create_bound_tools()

See references/dependency-injection.md for complete guide

4. Streaming Responses

Stream text with tool call tracking:

async def stream_chat(self, prompt: str) -> AsyncIterable[str]:
    """Stream agent responses"""
    agent = self._create_agent()

    async with agent.run_stream(prompt) as result:
        async for chunk in result.stream_text(delta=True):
            if chunk:
                yield chunk
                await asyncio.sleep(0)  # Force flush

See references/streaming.md for SSE implementation

5. Multi-Provider Support

Switch between LLM providers:

from model_provider import ModelProvider

# Anthropic
model = ModelProvider.ANTHROPIC.create(
    model_name="claude-3-5-sonnet-20241022",
    api_key="sk-ant-..."
)

# OpenAI
model = ModelProvider.OPENAI.create(
    model_name="gpt-4",
    api_key="sk-..."
)

# Ollama (local)
model = ModelProvider.OLLAMA.create(
    model_name="llama3.2",
    base_url="http://localhost:11434/v1"
)

See references/providers.md for all providers

Common Workflows

Building a Web Service

  1. Scaffold project with web example:
python scripts/scaffold_agent.py my_service --web
  1. Customize service.py with your business logic
  2. Add tools in tools.py:
@tool_registry.register(...)
async def my_tool(param: str) -> str:
    return f"Processed: {param}"
  1. Update example_fastapi.py with your endpoints
  2. Run:
uvicorn example_fastapi:app --reload

Building a CLI Application

  1. Scaffold project with CLI example:
python scripts/scaffold_agent.py my_cli --cli
  1. Customize agent configuration in agent_factory.py
  2. Add tools for your domain
  3. Run:
python example_cli.py

Adding Service Dependencies

  1. Define your service:
@dataclass
class MyService:
    config: dict

    async def process(self, data: str) -> str:
        return f"Processed: {data}"
  1. Add tools using the service:
@tool_registry.register(...)
async def process_data(service: MyService, data: str) -> str:
    return await service.process(data)
  1. Update ToolCollection:
@dataclass
class ToolCollection:
    my_service: MyService

    def get_all_tools(self):
        # Automatically binds my_service
        return self._create_bound_tools()
  1. Initialize in service layer:
def _create_tools(self):
    my_service = MyService(config={...})
    return ToolCollection(my_service=my_service)

Implementing Streaming with SSE

  1. Define SSE message types in schema.py:
class SSEChunkMessage(BaseModel):
    type: Literal["chunk"] = "chunk"
    content: str
  1. Update service.py to yield SSE messages:
async def stream_chat(self, prompt: str):
    async with agent.run_stream(prompt) as result:
        async for chunk in result.stream_text(delta=True):
            yield SSEChunkMessage(content=chunk).model_dump_json()
            await asyncio.sleep(0)
  1. Add SSE wrapper in utils.py:
async def wrap_sse_stream(source):
    async for chunk in source:
        yield f"data: {chunk}\n\n"
        await asyncio.sleep(0)
  1. Use in FastAPI:
@app.post("/chat")
async def chat(prompt: str):
    text_stream = service.stream_chat(prompt)
    sse_stream = wrap_sse_stream(text_stream)
    return StreamingResponse(
        sse_stream,
        media_type="text/event-stream"
    )

Reference Documentation

For detailed implementation guides:

  • architecture.md - Complete architectural patterns, component responsibilities, data flow, and extension points
  • dependency-injection.md - Deep dive into DI pattern with signature manipulation, multiple services, and testing
  • streaming.md - Streaming implementation, SSE formatting, tool call tracking, and client integration
  • providers.md - Multi-provider support, configuration, model selection, and cost optimization

Customization Guide

Adding New Agent Types

  1. Define enum value in agent_factory.py:
class AgentType(str, Enum):
    GENERAL = "general"
    SPECIALIZED = "specialized"
  1. Register configuration:
agent_factory.register_config(AgentConfig(
    agent_type=AgentType.SPECIALIZED,
    system_prompt="Custom prompt...",
    tool_names=["specific_tool"],
    model_settings={"temperature": 0.0}
))

Adding New Tool Categories

  1. Extend ToolCategory in tool_registry.py:
class ToolCategory(str, Enum):
    UTILITY = "utility"
    DATA = "data"
    CUSTOM = "custom"  # New category
  1. Register tools with new category:
@tool_registry.register(
    name="custom_tool",
    category=ToolCategory.CUSTOM,
    description="Custom functionality"
)
async def custom_tool() -> str:
    return "Custom result"

Implementing Custom State Storage

Replace in-memory storage with Redis/DB:

class RedisStateStore(StateStore):
    def __init__(self, redis_client):
        self.redis = redis_client

    async def save(self, state: AgentState):
        await self.redis.set(
            state.conversation_id,
            state.to_json(),
            ex=86400
        )

    async def load(self, conversation_id: str):
        data = await self.redis.get(conversation_id)
        return AgentState.from_json(data) if data else None

Best Practices

  1. Use environment variables for configuration (API keys, model names)
  2. Implement proper error handling in tools and service layer
  3. Set usage limits to prevent infinite tool loops (UsageLimits(request_limit=10))
  4. Force flush when streaming with await asyncio.sleep(0)
  5. Track tool execution by monitoring result.all_messages()
  6. Test with multiple providers to ensure compatibility
  7. Use type hints throughout for better IDE support
  8. Log important events for debugging and monitoring
  9. Validate tool inputs with Pydantic models
  10. Handle state persistence properly for conversation continuity

Troubleshooting

Tools not being called:

  • Check tool descriptions are clear
  • Verify tool signatures are correct
  • Ensure tools are registered before agent creation
  • Check provider supports function calling

Streaming not real-time:

  • Add await asyncio.sleep(0) after each yield
  • Check SSE headers (disable buffering)
  • Verify client is consuming stream properly

Service dependencies not working:

  • Verify first parameter type annotation matches service type
  • Check _bind_service is called for the tool
  • Ensure signature is updated after binding

State not persisting:

  • Verify state_store.save() is called after response
  • Check state store implementation
  • Ensure conversation_id is passed correctly

Resources

scripts/

scaffold_agent.py - Generates complete agent project structure with all core modules, examples, and configuration files. Run with --minimal, --web, or --cli flags to customize output.

references/

Detailed implementation guides:

  • architecture.md - Layered architecture, component responsibilities, design patterns
  • dependency-injection.md - Service injection pattern with signature manipulation
  • streaming.md - Real-time streaming, SSE, tool call tracking
  • providers.md - Multi-provider configuration and usage

平台分布

Claude Code

27.95%
按下载量换算41

Gemini CLI

23.36%
按下载量换算34

Antigravity

17.55%
按下载量换算26

OpenCode

12.93%
按下载量换算19

windsurf

7.9%
按下载量换算12

github-copilot

3.11%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills