|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Tech Stack & Architecture |
| 4 | +- Language/Version: Python 3.10+ |
| 5 | +- Core Libraries: `agent-utilities`, `fastmcp`, `pydantic-ai` |
| 6 | +- Key principles: Functional patterns, Pydantic for data validation, asynchronous tool execution. |
| 7 | +- Architecture: |
| 8 | + - `mcp.py`: Main MCP server entry point and tool registration. |
| 9 | + - `agent.py`: Pydantic AI agent definition and logic. |
| 10 | + - `skills/`: Directory containing modular agent skills (if applicable). |
| 11 | + - `agent/`: Internal agent logic and prompt templates. |
| 12 | + |
| 13 | +### Architecture Diagram |
| 14 | +```mermaid |
| 15 | +graph TD |
| 16 | + User([User/A2A]) --> Server[A2A Server / FastAPI] |
| 17 | + Server --> Agent[Pydantic AI Agent] |
| 18 | + Agent --> Skills[Modular Skills] |
| 19 | + Agent --> MCP[MCP Server / FastMCP] |
| 20 | + MCP --> Client[API Client / Wrapper] |
| 21 | + Client --> ExternalAPI([External Service API]) |
| 22 | +``` |
| 23 | + |
| 24 | +### Workflow Diagram |
| 25 | +```mermaid |
| 26 | +sequenceDiagram |
| 27 | + participant U as User |
| 28 | + participant S as Server |
| 29 | + participant A as Agent |
| 30 | + participant T as MCP Tool |
| 31 | + participant API as External API |
| 32 | +
|
| 33 | + U->>S: Request |
| 34 | + S->>A: Process Query |
| 35 | + A->>T: Invoke Tool |
| 36 | + T->>API: API Request |
| 37 | + API-->>T: API Response |
| 38 | + T-->>A: Tool Result |
| 39 | + A-->>S: Final Response |
| 40 | + S-->>U: Output |
| 41 | +``` |
| 42 | + |
| 43 | +## Commands (run these exactly) |
| 44 | +# Installation |
| 45 | +pip install .[all] |
| 46 | + |
| 47 | +# Quality & Linting (run from project root) |
| 48 | +pre-commit run --all-files |
| 49 | + |
| 50 | +# Execution Commands |
| 51 | +# vector-mcp\nvector_mcp.mcp:mcp_server\n# vector-agent\nvector_mcp.agent:agent_server |
| 52 | + |
| 53 | +## Project Structure Quick Reference |
| 54 | +- MCP Entry Point → `mcp.py` |
| 55 | +- Agent Entry Point → `agent.py` |
| 56 | +- Source Code → `vector_mcp/` |
| 57 | +- Skills → `skills/` (if exists) |
| 58 | + |
| 59 | +### File Tree |
| 60 | +```text |
| 61 | +├── .bumpversion.cfg\n├── .dockerignore\n├── .env\n├── .gitattributes\n├── .github\n│ └── workflows\n│ └── pipeline.yml\n├── .gitignore\n├── .pre-commit-config.yaml\n├── .pytest_cache\n│ ├── .gitignore\n│ ├── CACHEDIR.TAG\n│ ├── README.md\n│ └── v\n│ └── cache\n├── AGENTS.md\n├── Dockerfile\n├── LICENSE\n├── MANIFEST.in\n├── README.md\n├── compose.yml\n├── debug.Dockerfile\n├── mcp\n│ ├── documents\n│ └── pgdata\n├── mcp.compose.yml\n├── pyproject.toml\n├── pytest.ini\n├── requirements.txt\n├── scripts\n│ ├── debug_embedding.py\n│ ├── debug_full.py\n│ ├── debug_pg.py\n│ ├── investigate_timeout.py\n│ ├── test_embedding.py\n│ ├── validate_a2a_agent.py\n│ ├── validate_agents.py\n│ ├── validate_all_dbs.py\n│ └── verify_deps.py\n├── tests\n│ ├── reproduce_chunking.py\n│ ├── test_databases.py\n│ ├── test_optional_dependencies.py\n│ ├── test_protocol_compliance.py\n│ ├── test_pruning.py\n│ └── test_vector_mcp.py\n└── vector_mcp\n ├── __init__.py\n ├── __main__.py\n ├── agent\n │ ├── AGENTS.md\n │ ├── CRON.md\n │ ├── CRON_LOG.md\n │ ├── HEARTBEAT.md\n │ ├── IDENTITY.md\n │ ├── MEMORY.md\n │ ├── USER.md\n │ ├── mcp_config.json\n │ └── templates.py\n ├── agent.py\n ├── mcp.py\n ├── retriever\n │ ├── __init__.py\n │ ├── chromadb_retriever.py\n │ ├── couchbase_retriever.py\n │ ├── llamaindex_retriever.py\n │ ├── mongodb_retriever.py\n │ ├── postgres_retriever.py\n │ ├── qdrant_retriever.py\n │ └── retriever.py\n └── vectordb\n ├── __init__.py\n ├── base.py\n ├── chromadb.py\n ├── couchbase.py\n ├── db_utils.py\n ├── mongodb.py\n ├── postgres.py\n └── qdrant.py |
| 62 | +``` |
| 63 | + |
| 64 | +## Code Style & Conventions |
| 65 | +**Always:** |
| 66 | +- Use `agent-utilities` for common patterns (e.g., `create_mcp_server`, `create_agent`). |
| 67 | +- Define input/output models using Pydantic. |
| 68 | +- Include descriptive docstrings for all tools (they are used as tool descriptions for LLMs). |
| 69 | +- Check for optional dependencies using `try/except ImportError`. |
| 70 | + |
| 71 | +**Good example:** |
| 72 | +```python |
| 73 | +from agent_utilities import create_mcp_server |
| 74 | +from mcp.server.fastmcp import FastMCP |
| 75 | + |
| 76 | +mcp = create_mcp_server("my-agent") |
| 77 | + |
| 78 | +@mcp.tool() |
| 79 | +async def my_tool(param: str) -> str: |
| 80 | + """Description for LLM.""" |
| 81 | + return f"Result: {param}" |
| 82 | +``` |
| 83 | + |
| 84 | +## Dos and Don'ts |
| 85 | +**Do:** |
| 86 | +- Run `pre-commit` before pushing changes. |
| 87 | +- Use existing patterns from `agent-utilities`. |
| 88 | +- Keep tools focused and idempotent where possible. |
| 89 | + |
| 90 | +**Don't:** |
| 91 | +- Use `cd` commands in scripts; use absolute paths or relative to project root. |
| 92 | +- Add new dependencies to `dependencies` in `pyproject.toml` without checking `optional-dependencies` first. |
| 93 | +- Hardcode secrets; use environment variables or `.env` files. |
| 94 | + |
| 95 | +## Safety & Boundaries |
| 96 | +**Always do:** |
| 97 | +- Run lint/test via `pre-commit`. |
| 98 | +- Use `agent-utilities` base classes. |
| 99 | + |
| 100 | +**Ask first:** |
| 101 | +- Major refactors of `mcp.py` or `agent.py`. |
| 102 | +- Deleting or renaming public tool functions. |
| 103 | + |
| 104 | +**Never do:** |
| 105 | +- Commit `.env` files or secrets. |
| 106 | +- Modify `agent-utilities` or `universal-skills` files from within this package. |
| 107 | + |
| 108 | +## When Stuck |
| 109 | +- Propose a plan first before making large changes. |
| 110 | +- Check `agent-utilities` documentation for existing helpers. |
0 commit comments