Skip to main content

tracegc-crewai

tracegc-crewai is an official adapter package providing TraceGC graph-based context compaction for CrewAI agents, crews, and tasks.

Installation

pip install tracegc-crewai

Or install with test dependencies:

pip install tracegc-crewai[test]

Quick Start

1. Compact CrewAI Execution Steps via step_callback

Use TraceGCCrewCallback or create_step_callback() to record and compact step outputs during Crew execution:

from crewai import Agent, Crew, Task
from tracegc_crewai import create_step_callback

# Create a TraceGC step callback
step_cb = create_step_callback(
    prune_semantic=True,
    tracked_decision_keys={"database", "cache_backend"}
)

# Instantiate CrewAI Agent and Crew with step_callback
agent = Agent(
    role="Backend Architect",
    goal="Design scalable infrastructure",
    backstory="Senior system architect"
)

task = Task(
    description="Select storage engine and caching layer",
    expected_output="Final tech stack recommendation",
    agent=agent
)

crew = Crew(
    agents=[agent],
    tasks=[task],
    step_callback=step_cb
)

# Run crew...
# crew.kickoff()

# Compact accumulated step context
result = step_cb.compact()
print("Compacted messages:", len(result.messages))
print("Pruned receipts:", len(result.receipts))

2. Manual Context Compaction via compact_messages

If you manage task histories or step outputs directly:

from tracegc_crewai import compact_messages

step_history = [
    "Configured database=postgres",
    "Switched database=mongodb due to schema flexibility",
]

result = compact_messages(step_history, prune_semantic=True, tracked_decision_keys={"database"})
for msg in result.messages:
    print(msg["content"])
# Output retains only the active 'mongodb' decision and prunes the superseded 'postgres' choice.

Why TraceGC instead of CrewAI's Built-in Memory?

CrewAI provides a built-in memory subsystem (memory=True) featuring ShortTermMemory (using ChromaDB vector RAG), LongTermMemory, and EntityMemory.

While CrewAI's built-in memory excels at semantic retrieval (RAG) across tasks:

  • CrewAI Memory retrieves relevant facts by embedding similarity, but retains all past execution steps in raw history. It does not prune obsolete variables, superseded tech choices, or dead search branches.
  • TraceGC builds a deterministic dependency DAG over trace events. It mathematically prunes obsolete states, superseded configuration decisions, and abandoned branches while preserving exact provenance and recoverable receipts.

Using tracegc-crewai alongside CrewAI's memory ensures your agents run with minimal token context windows, zero obsolete state confusion, and full auditability.

Metadata

Release files for tracegc-crewai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tracegc-crewai 0.1.0
File Size Uploaded Provenance Actions
tracegc_crewai-0.1.0.tar.gz 5.6 kB Without provenance Details for tracegc_crewai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tracegc-crewai 0.1.0
File Interpreter ABI Platform Actions
tracegc_crewai-0.1.0-py3-none-any.whl Python 3 none any Details for tracegc_crewai-0.1.0-py3-none-any.whl

Total release size: 10.4 kB

Release files / tracegc_crewai-0.1.0.tar.gz

Download URL tracegc_crewai-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
70c2361853262c3b8cb5a4921bcacdbe1029f98c48714e9f9d7e778005e04e61
BLAKE2b-256 checksum
How to use checksums
ff4262295d53511ade84313308d91d1731a9fcd00a9ddfd0da3733f7dddb9b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / tracegc_crewai-0.1.0-py3-none-any.whl

Download URL tracegc_crewai-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
161aceebe3fb4ab34636f35355fa62fadc2a35ae0d3cd8400480dc69bd697cc0
BLAKE2b-256 checksum
How to use checksums
777b2cee5733001f4d12204e1714f4b35155fad0f4365d71a782c1a32d8e8a64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for tracegc-crewai 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page