Skip to main content

Find hidden cost leaks and blind spots in your agentic AI workflows

Project description

๐Ÿ•ต๏ธ monk

Find hidden cost leaks and blind spots in your agentic AI workflows.

Drop monk on any trace file. Get a plain-English report of what's wasting tokens โ€” and exactly how to fix it.

$ monk run ./traces/

  ๐Ÿ•ต๏ธ  monk โ€” Agentic Workflow Blind Spot Detector
  Source: ./traces/   |   Calls analysed: 2,847

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  3 blind spots found  ยท  ~$62.40/day estimated waste  ยท  ~$1,872/month  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  ๐Ÿ”ด [1] Retry loop: 'web_search' called 4x in a row  ยท  ~$38.20/day
  Fix: Add a max-retries guard before calling 'web_search'.

  ๐Ÿ”ด [2] 'get_user_profile' returns empty 80% of the time  ยท  ~$19.10/day
  Fix: Guard against empty returns โ€” don't pass null context back to the LLM.

  ๐ŸŸก [3] Model overkill: gpt-4o used for simple tasks (62% of calls)  ยท  ~$5.10/day
  Fix: Route classify/format calls to gpt-4o-mini โ€” identical quality, 16x cheaper.

What monk detects

Detector What it finds
retry_loop Same tool called 3+ times in a row โ€” agent stuck, burning tokens
empty_return Tool returns null/empty and agent retries anyway
model_overkill Expensive model used for short, simple tasks
context_bloat System prompt consuming >55% of token budget, or unbounded history growth
agent_loop Agent cycling through the same step sequence without progress

Install

pip install monk-ai

Or run from source:

git clone https://github.com/Blueconomy/monk
cd monk
pip install -e .

Usage

Analyse a single file:

monk run agent_traces.jsonl

Analyse a folder of traces:

monk run ./traces/

Run specific detectors only:

monk run traces/ --detectors retry_loop,model_overkill

Export findings as JSON (great for CI):

monk run traces/ --json findings.json

Only show high-severity findings:

monk run traces/ --min-severity high

Use in CI โ€” monk exits with code 1 if high-severity findings exist:

- name: Run monk
  run: monk run ./traces/ --min-severity high

Trace format

monk auto-detects OpenAI, Anthropic, and LangSmith trace formats.

For custom logging, any JSONL file with these fields works:

{"session_id": "abc123", "model": "gpt-4o", "input_tokens": 1200, "output_tokens": 80, "tool_name": "web_search", "tool_result": "some result"}

Supported fields:

Field Required Notes
model โœ… e.g. gpt-4o, claude-sonnet-4-6
input_tokens โœ… Prompt token count
output_tokens โœ… Completion token count
session_id Recommended Groups calls into sessions
tool_name Optional Name of tool called
tool_result Optional Result returned by tool
system_prompt_tokens Optional Enables context_bloat detection

monk also natively parses:

  • OpenAI Chat Completions API response format
  • Anthropic Messages API response format
  • LangSmith run export format

Why monk?

Most observability tools show you dashboards and traces. monk finds the things you don't know to look for.

The patterns monk detects are the ones we found repeatedly when auditing real agentic workflows โ€” retry loops that nobody noticed, tools returning empty results silently, expensive models doing simple jobs. These don't show up as errors. They just quietly burn money.


Roadmap

  • Live mode: instrument running agents via OpenTelemetry
  • Prompt compression suggestions
  • Cross-workflow benchmarking
  • Slack / PagerDuty alerts
  • Web dashboard

Contributing

PRs welcome. See CONTRIBUTING.md.

To add a new detector:

  1. Create monk/detectors/your_detector.py extending BaseDetector
  2. Add it to monk/detectors/__init__.py
  3. Add tests in tests/test_detectors.py

License

MIT โ€” free to use, modify, and distribute.


Built by Blueconomy AI โ€” Techstars '25.
If monk finds something useful, give us a โญ โ€” it helps more people find it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monk_ai-0.2.0.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monk_ai-0.2.0-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file monk_ai-0.2.0.tar.gz.

File metadata

  • Download URL: monk_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for monk_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2b8fcb64c8786887f714e5b2a7c89025b337197670234d3a3669f6300dbbadc8
MD5 6d7c06bf396770060af55ca8febbb552
BLAKE2b-256 a23533c2a9db7d2e9ebb2f3eb659a1334b3321eece5467279f1a0546532f8783

See more details on using hashes here.

File details

Details for the file monk_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: monk_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 51.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for monk_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e69e1f057d4f4418fcb82d17937d55bf8446f56384b3329532db3b70bac7e5c2
MD5 ce61f75b08837224b28012fd16b83ade
BLAKE2b-256 e76ec81385a6d157bb5b103e854ce2ac9af61a3a831b759e853ae5907cd98a88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page