Map every AI API call in a codebase — offline, no LLM, no keys. Opens a webpage of your providers, models, and agents.
Project description
agentmap
Map every AI API call in a codebase — offline, no LLM, no API keys. Run one command and get a webpage showing which files call which providers, what models you use, and what each agent is responsible for.
pip install agentmap-scan
cd your-project
agentmap
A browser page opens with four sections:
- Calls by file — every AI API call site,
file:line, provider-tagged. - Providers & models — the distinct providers and model names in use, with counts.
- Agents & responsibilities — each agent's name and what its system prompt says it does.
- Routing — the env vars to send those calls through a gateway.
How it works
Pure regex over your source — it matches provider endpoint hosts
(api.openai.com, api.anthropic.com, …) and SDK call signatures
(.chat.completions.create, .messages.create, …), so it finds calls in
Python, JS/TS, Go, Rust, Ruby, PHP, Java, shell/curl — not just the official
SDKs. Agent responsibilities come straight from the system prompts in your code,
trimmed to one line. Nothing leaves your machine.
Detects 20 providers: OpenAI, Anthropic, Google Gemini/Vertex, Azure OpenAI, DeepSeek, Groq, xAI, Mistral, Cohere, Bedrock, Together, Fireworks, OpenRouter, Perplexity, Replicate, Hugging Face, Ollama, LiteLLM, LangChain.
Commands
agentmap [PATH] # scan + open the report (default: current dir)
agentmap --no-open PATH # scan, write the HTML, don't launch a browser
agentmap install PATH # write .env.agentmap routing env vars
agentmap install PATH --auto # also rewrite hardcoded provider base_urls in place
Routing → save money
agentmap install writes the env vars that point your OpenAI/Anthropic-compatible
calls at a gateway. Point them at Brevitas
to compress context losslessly and cut your token bill:
agentmap install . --target http://localhost:4242
source .env.agentmap
Limitations (honest)
Agent detection is a heuristic. It reliably catches raw OpenAI/Anthropic message
dicts, system=/system_prompt=/instructions= assignments (incl. X_system,
X_PROMPT names), CrewAI Agent(role=…), and .agent("name") calls. It does
not yet understand graph frameworks (LangGraph node graphs, AutoGen). PRs
adding per-framework matchers welcome.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentmap_scan-0.1.0.tar.gz.
File metadata
- Download URL: agentmap_scan-0.1.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae12caff2a4a562a6d37e4e7c220266ceed70cfeaff1e0949f8eabdab697e875
|
|
| MD5 |
c76881238565a9fc3d53b1f048717132
|
|
| BLAKE2b-256 |
614b35756404cd44928834eaad509774f2871d883d35fc7d4191a1f039bad3ee
|
File details
Details for the file agentmap_scan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentmap_scan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1c43ca0f1d79b40e791f05f14d5b860a96f6e59df2263e9c0a4f635392cb962
|
|
| MD5 |
e5c1b2a5c6cf6abf3b1627158a5b5a1c
|
|
| BLAKE2b-256 |
c1253680ceef2cf615f75f888cc267a81b9913f1f3b93858683f7561602d6bd1
|