Build a modular AI agent framework with dynamic tool registration, function calling, memory, and multi-step reasoning.
You are an AI agent architect. Build a production-grade agent framework. ## Configuration - **LLM Backend**: [LLM e.g. Claude 4 / GPT-5 / Llama 4] - **Tools**: [TOOLS e.g. web_search, calculator, code_executor, file_manager, database_query] - **Memory Type**: [MEMORY e.g. conversation buffer / vector store / knowledge graph] - **Max Iterations**: [MAX_ITER e.g. 10] - **Framework**: [FRAMEWORK e.g. pure Python / LangGraph / CrewAI] ## Agent Architecture ### 1. Core Agent (`agent/core.py`) - ReAct (Reason + Act) loop implementation - Thought → Action → Observation cycle - Configurable stopping conditions: max iterations, task completion signal, confidence threshold - Parallel tool execution when actions are independent - Streaming output for real-time thought process visibility ### 2. Tool Registry (`agent/tools/`) - Base Tool abstract class with: - name, description, parameter_schema (JSON Schema) - execute(params) → ToolResult - validate_params(params) → bool - Dynamic tool registration and discovery - Tool permission levels (read-only, write, execute) - Tool usage metering and cost tracking Implement these tools for [TOOLS]: - Each tool with proper error handling and timeout - Sandboxed code execution with resource limits - Rate-limited API calls with circuit breaker ### 3. Memory System (`agent/memory/`) - Short-term: conversation buffer with sliding window - Long-term: [MEMORY] for persistent knowledge - Working memory: scratchpad for multi-step reasoning - Memory retrieval with relevance scoring - Memory compression for long conversations ### 4. Planning Module (`agent/planning/`) - Task decomposition: break complex tasks into subtasks - Plan generation with dependency graph - Plan revision when steps fail - Progress tracking with completion estimation ### 5. Safety Layer (`agent/safety/`) - Input validation and prompt injection detection - Output filtering for sensitive information - Action confirmation for destructive operations - Audit logging for all tool invocations - Budget limits (token usage, API calls, execution time) ### 6. Evaluation (`agent/eval/`) - Task completion rate measurement - Tool selection accuracy scoring - Reasoning quality assessment - Benchmark suite with standard agent tasks Provide modular, extensible code with dependency injection and comprehensive tests.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro, Llama 4.
Choose your LLM backend and define the tools your agent needs. Start with 2-3 tools and add more incrementally. Test the ReAct loop with simple tasks before complex multi-step scenarios.
Initial release
Sign in and download this prompt to leave a review.