How cafedonggua/pet_agent works
Project type and purpose
• From the file tree and README, this project is an open-source AI Agent framework (named “Pet_Agent”) written in Python.
• It provides a standalone agent server, a core planning/memory subsystem, and client scripts (in apiTest/) to drive or simulate interactions over HTTP or WebSocket.
File structure
• Top-level files:
• main.py – application entry point, likely starts the agent server
• requirements.txt – lists Python dependencies (e.g., FastAPI, OpenAI SDK, vector DB client)
• agent/ directory – contains the core agent logic broken into:
• agent_core.py & agent_init.py – bootstrap and orchestrate the agent’s lifecycle
• context.py – runtime context and configuration handling
• memory_manager.py, vector_memory.py, summary_memory.py, singleton_memory.py – various memory backends and retrieval strategies
• plan_manager.py, singleton_plan.py – logic for plan generation and stateful plan storage
• server.py – exposes an HTTP/WS API layer (likely via FastAPI or similar)
• tools.py & utils.py – helper functions and external tool adapters
• apiTest/ directory – client-side scripts for testing:
• api_client.py & ws_client.py – call into the running server via REST/WS
• simulate_log_writer.py – generate synthetic events/logs for the agent to consume
README for additional insights
• We infer from code names and requirements that it uses a vector database (for memory), an LLM (OpenAI or local model), and a lightweight web framework.