Terminal-Based AI Agent
An agentic CLI with reasoning mode, file operations, session persistence, and MCP tool integration. A full AI coding assistant that runs in your terminal.
Iter Chat
Connected to agent-server. Type your message and press Enter.
Model: qwen3-coder:32b | MCP: 3 servers
Using tool: iter_get_file
The app follows a FastAPI + service layer pattern:
- main.py — App factory with lifespan, mounts routers
- endpoints/ — Route handlers, thin wrappers over services
- services/ — Business logic, DB access, external calls
- models.py — Pydantic models for request/response
384 tokens | 1.2s
Reasoning...
The existing pattern uses router modules in endpoints/. I should add a new health.py router with a /health GET endpoint that pings the database connection pool...
Here's the implementation:
@router.get("/health")
async def health_check(db: AsyncSession = Depends(get_db)):
await db.execute(text("SELECT 1"))
return {"status": "ok"}
Add this to endpoints/health.py and mount in main.py.
612 tokens | 2.8s
CLI capabilities
Streaming chat
Real-time SSE streaming from local Ollama models with Rich terminal formatting. Markdown rendering, syntax highlighting, and structured output.
Reasoning mode
Chain-of-thought reasoning for complex problems. Structured output with explicit thinking and answer sections. Toggle per-query or globally.
File operations
Read, write, list, and analyze files with per-directory permission guards. MCP filesystem fallback for sandboxed access.
Session persistence
Save and load conversations to disk. Resume where you left off. Full session history with metadata tracking.
Project analysis
AI-powered codebase understanding. Directory tree visualization, file summaries, and architecture analysis.
Built-in commands
Chat & reasoning
/reason for chain-of-thought, /model to switch models, /temp and /tokens for generation params.
File operations
/read, /write, /ls, /tree with syntax highlighting and permission guards.
Sessions
/save, /load, /sessions for persistent conversations. Resume any previous session.
MCP tools
/tools, /servers, /connect for MCP server management. Auto tool discovery and execution.
Security model
The CLI uses a per-directory permission system for safe file access:
Read permissions
Granted per-directory. Access history tracked for audit.
Write permissions
Explicit approval required. Subdirectory management with allow/deny lists.
Execute permissions
Code execution requires sandbox MCP server. Pre-execution confirmation.