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.1.0.tar.gz (18.6 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.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for monk_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd02de2c4ef4dbd296f9422ddbf2de7ff0a459f4b6b9da66b7e581443e70dc5b
MD5 6c3a0251ba041b3667bb82efa6b50348
BLAKE2b-256 ec5c33aae25f0dd6ab2cd6b0cde6e680fbdb828e00bfca026ef2a61a0fc46175

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for monk_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4539cc8a96e758eb8e0831828711efcd0c54b8aacecc41c37d83ae9da1da4f0
MD5 36b527cfbe7845c285b6f201176ef523
BLAKE2b-256 f9dcadc6ee32737cf6d50d31f273d7edb5d7a7c6941fe31a993ee7678fdcf2a3

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