{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "pydantic-pydantic-ai--build-your-own-terminal-coding-agent",
 "repo": "pydantic/pydantic-ai",
 "repo_url": "https://github.com/pydantic/pydantic-ai",
 "repo_slug": "pydantic-pydantic-ai",
 "title": "Build your own terminal coding agent in a few lines",
 "page_title": "How to build your own terminal coding agent in a few lines with Pydantic AI",
 "summary": "Use Pydantic AI Harness's Coder capability to get file access, shell, repo context and sub-agents in one agent.",
 "who": "An engineer who wants a coding agent they fully control, with their choice of models.",
 "problem": "Off-the-shelf coding agents are hard to customise and tie you to one vendor.",
 "outcome": "A chat-in-the-terminal coding agent built from composable capabilities you can swap or extend.",
 "steps": [
  "Install with `uv add pydantic-ai \"pydantic-ai-harness[coder]\"`",
  "Create an Agent with capabilities Coder(), and optionally WebSearch() and an Advisor on a second model, as in the README",
  "Call agent.to_cli_sync() and run the file to chat with it",
  "Or try it without code using the README's uvx command that runs the exported coder_agent with clai",
  "Replace Coder() with its building blocks such as FileSystem, Shell and RepoContext to customise it"
 ],
 "agent_prompt": "Using pydantic/pydantic-ai and pydantic-ai-harness[coder], create a terminal coding agent on <model> with Coder() and WebSearch(), restrict the shell to an allowlist, and run it on this repo to <task>.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The README's example model names may not match what your provider offers; use a model string your account supports.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python and uv",
  "An API key for the model provider you choose",
  "Optional extras: pydantic-ai-harness[coder], pydantic-ai[temporal] and a Temporal setup, pydantic-ai[openai-realtime]",
  "Optional: a Logfire account for tracing"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "The agent needs provider API keys and, with Coder, can read files and run shell commands in its workspace; keep it in a project folder you can reset."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/pydantic-pydantic-ai/build-your-own-terminal-coding-agent/",
 "md": "https://dedupedai.com/use-cases/pydantic-pydantic-ai/build-your-own-terminal-coding-agent/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/pydantic-pydantic-ai--build-your-own-terminal-coding-agent.json",
 "api_version": "v1"
}
