Skip to content

contextweaver

Context firewall + tool router for MCP and tool-heavy agents. Phase-specific, budget-aware context engineering with a deterministic core.

contextweaver architecture overview

Minimal core dependencies · deterministic output · Python ≥ 3.10

Context engineering is the discipline of deciding what goes into a model's context window, when, and at what cost — see the canonical framing.


contextweaver provides two cooperating engines that solve the context window problem for tool-using AI agents:

  • Context Engine — eight-stage pipeline: candidates → dependency closure → sensitivity filter → firewall → scoring → dedup → selection → rendering. See the Context Firewall page for the load-bearing firewall primitive and Architecture for the full pipeline.
  • Routing Engine — bounded DAG + beam search over large tool catalogs, producing compact LLM-friendly ChoiceCards. See the Tool Router page.

Use it when your agent has too many MCP / FastMCP / Python tools, too much tool-result data, or a long history competing for the same prompt budget. Do not use it as a replacement for your agent framework, model SDK, memory database, RAG system, or observability stack.

Get started

10-Minute Quickstart{ .md-button .md-button--primary } API Reference{ .md-button }

Animated demo recording

Section What you'll find
Quickstart Install, first context build, firewall demo, routing demo
Concepts Core type glossary: ContextItem, Phase, ChoiceGraph, …
Ecosystem Map How contextweaver compares with agent frameworks, MCP, memory, RAG, and observability
Adopter Benchmark Report Cost, prompt-size, latency, routing-quality, and failure-mode framing
Stability Alpha/Beta/1.0 readiness and public API stability boundaries
Launch Kit Reusable public copy, assets, and responsible-claims checklist
Runtime Loop Four-phase flow diagram and pseudo-code
MCP Integration Tool conversion, session loading, firewall with MCP
A2A Integration Agent cards and multi-agent sessions
Architecture Pipeline details, design rationale, module map
API Reference Auto-generated reference from source docstrings