How carlos-mb/agentsmith works
Agent Smith is an autonomous coding agent for MBPP exercises and SWE-bench repository issues. A CLI loads a task and invokes its benchmark adapter; the shared loop requests model output, extracts executable code, runs it in a persistent restricted worker, and feeds observations back until completion or limits. Worker tool calls are relayed through the agent to an MCP server. MBPP tools run candidate tests in Docker; SWE-bench tools inspect and edit a checkout, run its tests, and return a patch. README documents both adapters; sampled excerpts confirm shared-loop, provider, worker, MCP, and SWE tool behavior, but not every adapter call.
Main entry points: io.py Task I/O · agent_loop.py Thought loop · agent_mbpp.py MBPP CLI · agent_swebench.py SWE CLI
Components 22
Task entry
- MBPP CLI
agent_mbpp.py - SWE CLI
agent_swebench.py - Task I/O
agent_smith/io.py - Task models
agent_smith/models.py
Agent loop
- Thought loop
agent_smith/agent_loop.py - LLM provider
agent_smith/providers.py - Code extraction
agent_smith/code_extraction.py
Execution tools
- Worker session
agent_smith/sandbox_session.py - Restricted worker
agent_smith/sandbox.py - MCP client
agent_smith/mcp_client.py
Benchmark adapters
- MBPP adapter
agent_smith/mbpp_agent.py - SWE adapter
agent_smith/swebench_agent.py - MBPP MCP tools
mcp_tools_mbpp.py - MBPP test runner
agent_smith/mbpp_tools.py - SWE MCP tools
mcp_tools_swebench.py - SWE repository tools
agent_smith/swebench_tools.py - SWE container
agent_smith/swebench_agent.py
Other components
- Task operator
- LLM service
- Docker
- Task checkout
- Solution output
Connections 28
- Task operator → MBPP CLI: starts task
- Task operator → SWE CLI: starts task
- MBPP CLI → Task I/O: loads task
- SWE CLI → Task I/O: loads task
- Task I/O → Task models: validates data
- MBPP CLI → MBPP adapter: runs adapter
- SWE CLI → SWE adapter: runs adapter
- MBPP adapter → Thought loop: starts loop
- SWE adapter → Thought loop: starts loop
- Thought loop → LLM provider: requests completion
- LLM provider → LLM service: sends request
- Thought loop → Code extraction: extracts code
- Thought loop → Worker session: executes code
- Worker session → Restricted worker: sends code
- Restricted worker → Worker session: returns observation
- Worker session → MCP client: dispatches tool call
- MCP client → MBPP MCP tools: calls tools
- MCP client → SWE MCP tools: calls tools
- MBPP MCP tools → MBPP test runner: delegates tests
- MBPP test runner → Docker: runs tests
- SWE MCP tools → SWE repository tools: delegates operations
- SWE repository tools → Task checkout: reads and edits
- SWE repository tools → Docker: runs container commands
- SWE adapter → SWE container: starts container
- SWE container → Docker: manages container
- MBPP CLI → Task I/O: writes result
- SWE CLI → Task I/O: writes result
- Task I/O → Solution output: serializes output