DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to build your own terminal coding agent in a few lines with Pydantic AI

Use Pydantic AI Harness's Coder capability to get file access, shell, repo context and sub-agents in one agent.

Short answer: Install with uv add pydantic-ai "pydantic-ai-harness[coder]"; then 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. All steps.

Credentials. 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.

Who it is forAn engineer who wants a coding agent they fully control, with their choice of models.

The problemOff-the-shelf coding agents are hard to customise and tie you to one vendor.

The outcomeA chat-in-the-terminal coding agent built from composable capabilities you can swap or extend.

What you need first

  • 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

Steps

  1. Install with uv add pydantic-ai "pydantic-ai-harness[coder]"
  2. Create an Agent with capabilities Coder(), and optionally WebSearch() and an Advisor on a second model, as in the README
  3. Call agent.to_cli_sync() and run the file to chat with it
  4. Or try it without code using the README's uvx command that runs the exported coder_agent with clai
  5. Replace Coder() with its building blocks such as FileSystem, Shell and RepoContext to customise it

Prompt for your agent

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>.

Caveat. The README's example model names may not match what your provider offers; use a model string your account supports.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for pydantic/pydantic-ai and "Build your own terminal coding agent in a few lines"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer