cli-and-apps
Guides agents using Pydantic AI CLI entry points, clai chat, clai web, Agent.to_cli, Agent.to_web, installed examples, and safe app scaffolds.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- cli-and-apps
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Guides agents using Pydantic AI CLI entry points, clai chat, clai web, Agent.to_cli, Agent.to_web, installed examples, and safe app scaffolds.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/cli-reference.md6.3 KB
- 参考文档references/example-app-recipes.md8.8 KB
- 参考文档references/troubleshooting.md7.3 KB
- 脚本scripts/check_cli_help.py4.6 KB
03 SKILL.md 正文
CLI and Apps
Use this sub-skill when the task is to run or troubleshoot clai, pai, python -m pydantic_ai, browser chat UI, installed example packages, or application scaffolds built around Pydantic AI agents.
Read First
- Read references/cli-reference.md when choosing CLI commands, flags, model options, custom agent loading,
Agent.to_cli(),Agent.to_web(), orclai webbehavior. - Read references/example-app-recipes.md when turning maintained Pydantic AI example patterns into a self-contained app scaffold without relying on original example files.
- Read references/troubleshooting.md when diagnosing CLI imports, missing API keys, invalid custom agent paths, web UI startup, optional extras, native-tool flags, or example dependency failures.
- Run scripts/check_cli_help.py when you need a safe no-network check that installed
clai/paihelp entry points are available.
Core Routing
- Use
clai "prompt"for one-shot terminal questions and bareclaifor interactive chat with slash commands. - Use
clai --list-modelsto inspect provider-prefixed model strings; route model/provider credential decisions to../models-and-providers/SKILL.md. - Use
clai --agent module:variableor an AgentSpec YAML/JSON path when the user already has an importableAgent; route agent construction details to../agent-core/SKILL.md. - Use
Agent.to_cli()orAgent.to_cli_sync()when a Python app should expose an existingAgentas an interactive terminal session. - Use
clai webfor a local development browser chat UI andAgent.to_web()when embedding the generated Starlette app in an ASGI stack; route deeper UI event streams, AG-UI, MCP, durable execution, and hooks to../mcp-and-integrations/SKILL.md. - Use installed
pydantic_ai_examplesmodules as runnable examples only when the examples package and required services/credentials are installed; otherwise distill the recipe into local app code.
Boundaries
- For
Agent(...), dependencies, run methods, streaming semantics,AgentSpec, deterministic testing, and message-history continuation mechanics, read../agent-core/SKILL.md. - For function tools, toolsets, retries, approvals, deferred tools, and tool schemas used inside apps, read
../tools-and-toolsets/SKILL.md. - For structured outputs, message serialization, multimodal inputs, and browser/chat history formats, read
../outputs-and-messages/SKILL.md. - For model strings, optional provider extras, API key environment variables, native tool compatibility, embeddings, and provider failures, read
../models-and-providers/SKILL.md. - For AG-UI, Vercel AI SDK event streams, Logfire, MCP, A2A, capabilities, and durable backends, read
../mcp-and-integrations/SKILL.md.
Non-Negotiables
- Prefer
claiover legacypaiin new user instructions; mentionpaionly for compatibility with existing installations or smoke checks. - Do not make runtime guidance depend on an original repository checkout, source examples, source tests, or local paths; use installed packages or bundled recipes.
- Do not run live provider calls, browser servers, databases, Docker, or cloud examples unless the user explicitly asked and has configured credentials/services.
- Treat
clai webandAgent.to_web()as local development/debugging surfaces, not production frontend architecture.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).