
Limit your token usage — or get bankrupt
Agentic workflows are quickly becoming the backbone of modern development — planning agents, review agents, refactoring agents, release agents. But there's a growing problem many teams underestimate: you're not scaling your AI usage, you're scaling your cost risk. If you don't control token usage, you will hit a cost wall.
Agentic workflows scale cost faster than value. A Codebase Knowledge Graph (e.g. Graphify) replaces expensive exploration with structured queries — cutting tool calls 3–4× and overall workflow cost ~50%.
Contents
The hidden cost driver: exploration, not intelligence
Most assume LLM cost comes from reasoning. In reality, the biggest cost driver is exploration inefficiency.
Typical agent behavior:
- List directories
- Search (grep) for patterns
- Read large files
- Repeat — every session
This leads to high token consumption, repeated work, slow execution, and poor cost predictability. At Arkido, where we specialize in integrations and AI agentic workflows, this was one of the first bottlenecks we identified when evaluating tooling.
Our evaluation: Graphify and the Codebase Knowledge Graph approach
As part of our work with AI-driven development, we evaluated Graphify, a tool that builds a Codebase Knowledge Graph.
The idea is simple but powerful: instead of letting agents rediscover your architecture, you give them a map of your entire codebase structure.
Graphify builds this map by extracting:
- Dependencies between files and modules
- Function and component relationships
- High-impact "hotspots"
- Architectural boundaries
All of this is exposed through lightweight queries instead of heavy file exploration.
The numbers (what actually matters)
We tested the same architecture-heavy task with and without a knowledge graph.
| Metric | With Graphify | Without |
|---|---|---|
| Time to complete | ~45 seconds | ~3 minutes |
| Tool calls | 18 | 65 |
| Reduction | 3.6× fewer calls | — |
At Arkido, we don't just look at performance — we look at cost implications. Tool calls = cost multipliers. Reducing them by 3–4× has a direct impact on your AI budget.
Where the savings actually happen
In a deeper benchmark (refactoring + code quality analysis), we broke down the workflow:
| Phase | Without graph | With graph |
|---|---|---|
| Structural exploration | ~25–30 calls | ~7 calls |
| Pattern detection (grep etc.) | ~12 calls | ~12 calls |
| Total | ~37–42 | ~19 |
Key insight from our evaluation:
- ~75% reduction in structural exploration
- ~50% reduction overall
The real inefficiency isn't in analysis — it's in finding what to analyze.
The shift: from exploration to structured querying
Old way (expensive)
- Explore first
- Understand later
- Miss things → re-explore
New way (efficient)
- Query structure first
- Identify hotspots
- Dive into code with precision
This is the pattern we now recommend in our AI integration work: Graph first, grep second. The graph tells you where to look; traditional tools tell you what you're looking at.
Real-world agent impact
Planning agent
| Metric | Without | With graph |
|---|---|---|
| Tool calls | ~30 | ~8 |
| Speed | Baseline | ~4× faster |
Review agent
| Metric | Without | With graph |
|---|---|---|
| Tool calls | ~12 | ~4 |
| Speed | Baseline | ~3× faster |
Refactoring / architecture analysis
- ~50% fewer tool calls
- Better identification of high-risk areas
Quality is part of cost
One of the most overlooked cost drivers is missed context. When agents miss important connections they produce weaker output, need retries, and explore again.
In our evaluation, graph-based workflows uncovered critical issues that brute-force exploration would likely miss, because the agent started with high-impact nodes instead of random sampling.
Better prioritization reduces both cost and risk.
A simple cost model
From an integration and architecture perspective: Total AI Cost ≈ Cost per call × Number of calls × Retry factor
A Codebase Knowledge Graph reduces both number of calls and retry factor. That's why the impact is multiplicative, not incremental.
This is the same shift we saw in cloud
| Before | After |
|---|---|
| Let agents explore everything | Give agents structured context |
| Optimize prompts | Optimize workflows |
| Scale usage | Control cost |
Trade-offs (and when it makes sense)
Benefits
- 3–4× fewer tool calls
- ~50% overall reduction in workflows
- Faster execution
- Better architectural decisions
- More predictable cost
Limitations
- Does not replace code-level inspection
- Requires keeping the graph updated (automated in practice)
Arkido perspective
From our perspective at Arkido — working at the intersection of integration, architecture, and AI agent workflows — this is not just a tooling choice. It's an architectural pattern.
We see Codebase Knowledge Graphs (with tools like Graphify) becoming:
- A standard component in AI-enabled development platforms
- A cost control mechanism for LLM usage
- A foundation for scalable agentic workflows
Key takeaways
- Token usage is the new cloud cost problem
- Most cost comes from exploration, not reasoning
- A Codebase Knowledge Graph eliminates repeated discovery
- Graphify proved this in practice: 3.6× fewer tool calls, ~50% total reduction
- The winning pattern: Graph first, then everything else
Vanliga frågor (FAQ)
What is a Codebase Knowledge Graph?
A structured representation of a codebase that maps dependencies and architecture, allowing agents to query structure instead of exploring files manually.
How does Graphify reduce token usage?
By replacing expensive exploration steps with efficient graph queries, reducing the number of tool calls significantly.
Why are agentic workflows expensive?
Because agents repeatedly explore large codebases from scratch, consuming tokens and tool calls without reusable structural context.
Does this replace tools like grep or file reading?
No. It complements them — graphs handle structure, while traditional tools handle implementation details.
What are "god nodes"?
Highly connected parts of a codebase that indicate high impact and risk when modified.
When should you implement this approach?
When you have growing AI usage, multiple agents, or increasing costs — especially in complex or long-lived systems where repeated exploration becomes expensive.
Nyckelord
- AI cost optimization
- token usage reduction
- Graphify
- Codebase Knowledge Graph
- agentic workflows
- AI integration
- Arkido
- LLM cost control
- MCP tools
- dependency graph
- software architecture AI
- development productivity
Källor

VD / CEO
Kontakta Martin för mer information om hur vi kan hjälpa dig.
Martin Holmberg

