Skip to content

feat: real CrewAI integration using mcps field (not simulation)#51

Merged
ascender1729 merged 1 commit into
mainfrom
feat/real-crewai-integration
Apr 17, 2026
Merged

feat: real CrewAI integration using mcps field (not simulation)#51
ascender1729 merged 1 commit into
mainfrom
feat/real-crewai-integration

Conversation

@ascender1729

Copy link
Copy Markdown
Member

Summary

Adds integrations/examples/crewai_real_integration.py, a real CrewAI integration that replaces the simulation-only crewai_compliance.py pattern.

The new script uses the actual crewai.Agent / Task / Crew / Process classes, and connects to the Attestix MCP server over stdio via crewai_tools.MCPServerAdapter (which spawns python -m main and exposes all 47 Attestix tools as native CrewAI BaseTool wrappers).

Real vs simulation

Aspect crewai_compliance.py (existing) crewai_real_integration.py (new)
Imports Local @dataclass AgentRole stubs from crewai import Agent, Task, Crew, Process
Tool host In-process service calls MCPServerAdapter + stdio JSON-RPC subprocess
Tool wrappers None 47 real CrewAIMCPTool objects on Agent(tools=...)
Agent type check N/A assert isinstance(officer, crewai.Agent)
MCP transport None mcp.StdioServerParameters(command='python', args=['-m','main'])
LLM handling N/A Stub LLM when no OPENAI_API_KEY, real LLM when set

Crew layout

  1. Researcher - maps system to EU AI Act Annex III
  2. Compliance Officer - holds all 47 Attestix MCP tools, drives compliance checkpoints
  3. Report Writer - assembles final artefact

Compliance checkpoints exercised through the real CrewAI MCP tools

A. create_agent_identity for every crew member
B. create_compliance_profile (high-risk agent uses Annex III category 3 so Article 43 self-assessment is permitted)
C. log_action for every crew task (hash-chained audit trail)
D. record_conformity_assessment + generate_declaration_of_conformity for the high-risk Compliance Officer

Why not crew.kickoff()

Driving the Attestix MCP tools directly through the CrewAI wrappers keeps the example deterministic and free of external LLM dependencies, while still exercising the full CrewAI tool wrapper -> mcpadapt -> stdio JSON-RPC -> Attestix MCP server -> services -> on-disk storage code path. If OPENAI_API_KEY is set, CrewAI uses the real LLM; otherwise a stub LLM is installed purely to let Agent construction succeed (it is never invoked).

Simulation fallback

If crewai, crewai-tools, or mcp are not installable, or the real path raises at runtime, the script falls back to the same in-process flow used by google_adk_compliance.py. The fallback is clearly labelled in the output.

Test plan

  • pip install crewai 'crewai-tools[mcp]' completes successfully
  • python integrations/examples/crewai_real_integration.py exits 0
  • Output shows Connected. 47 Attestix MCP tools exposed as CrewAI tools.
  • Output shows isinstance(*, crewai.Agent): True for all three agents
  • Output shows crew type: crewai.crew.Crew with Process.sequential
  • 3 Attestix identities persisted to ~/.attestix/identities.json
  • 6 hash-chained audit entries persisted to ~/.attestix/provenance.json
  • Declaration of conformity issued (decl:...) for the high-risk agent
  • All 15 existing tests/integration/test_framework_integrations.py tests still pass

Reuse snippet

from crewai import Agent
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters

params = StdioServerParameters(command='python', args=['-m', 'main'])
with MCPServerAdapter(params) as attestix_tools:
    officer = Agent(role='Compliance Officer', tools=attestix_tools, ...)

Replaces the simulation-only crewai_compliance.py pattern with a real
CrewAI integration that wires Attestix into actual crewai.Agent / Task /
Crew objects and connects to the Attestix MCP server over stdio via
crewai_tools.MCPServerAdapter.

What is real about it:

  - from crewai import Agent, Task, Crew, Process
  - from crewai_tools import MCPServerAdapter
  - from mcp import StdioServerParameters
  - MCPServerAdapter spawns the Attestix MCP server as a stdio
    subprocess (python -m main) and exposes all 47 Attestix MCP tools
    as native CrewAI BaseTool wrappers.
  - The Compliance Officer agent is built with tools=mcp_tools so every
    Attestix capability is available to it at runtime.
  - Tool invocations go CrewAI wrapper -> mcpadapt -> stdio JSON-RPC
    -> Attestix MCP server -> services -> on-disk storage.

Crew layout:

  1. Researcher        - maps system to EU AI Act Annex III
  2. Compliance Officer - holds all 47 Attestix MCP tools, drives the
     compliance checkpoints (identity, profile, audit log, conformity
     assessment, declaration of conformity)
  3. Report Writer     - assembles the final artefact

Compliance checkpoints executed through the real CrewAI MCP tools:

  A. create_agent_identity for every crew member
  B. create_compliance_profile (high-risk profile uses Annex III
     category 3 so Article 43 self-assessment is permitted)
  C. log_action for every crew task (hash-chained audit trail)
  D. record_conformity_assessment + generate_declaration_of_conformity
     for the high-risk Compliance Officer agent

Why drive the MCP tools directly (not crew.kickoff()): this keeps the
example deterministic and free of external LLM dependencies while still
exercising the full CrewAI tool wrapper -> mcpadapt -> stdio code path.
If OPENAI_API_KEY is set in the environment, CrewAI uses the real LLM;
otherwise a stub LLM is installed purely to let Agent construction
succeed (it is never invoked).

Simulation fallback: if crewai, crewai-tools, or mcp are not installable
(or the real path raises at runtime), the script falls back to the same
simulated flow as google_adk_compliance.py so the example still produces
an audit trail and compliance status in offline CI environments. The
fallback is clearly labelled in the output.

Differences from the existing simulation crewai_compliance.py:

  - crewai_compliance.py uses local @DataClass AgentRole / Task stubs.
    The new script uses real crewai.Agent / Task / Crew instances and
    asserts isinstance(*, crewai.Agent) on construction.
  - crewai_compliance.py calls Attestix services directly in-process.
    The new script talks to the Attestix MCP server over stdio via
    the same adapter CrewAI would use at runtime.
  - crewai_compliance.py never exercises the CrewAI tool registration
    path. The new script attaches 47 Attestix tools to a real
    crewai.Agent via the tools= parameter.

Test:

  python integrations/examples/crewai_real_integration.py
  EXIT=0
  - 47 Attestix tools exposed through MCPServerAdapter
  - 3 real crewai.Agent instances + 1 real crewai.Crew
  - 3 Attestix identities persisted to ~/.attestix/identities.json
  - 6 hash-chained audit entries persisted to ~/.attestix/provenance.json
  - Declaration of conformity issued for the high-risk agent
  - 15 existing framework integration tests still pass
@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ascender1729 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 42 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 42 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a9ef9e08-af10-4fac-914b-8e218f1df8fa

📥 Commits

Reviewing files that changed from the base of the PR and between d3e9a69 and 59725f3.

📒 Files selected for processing (1)
  • integrations/examples/crewai_real_integration.py

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'ignore'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/real-crewai-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ascender1729 ascender1729 merged commit 4be8eb9 into main Apr 17, 2026
12 of 19 checks passed
@ascender1729 ascender1729 deleted the feat/real-crewai-integration branch April 17, 2026 08:54
ascender1729 added a commit that referenced this pull request Apr 17, 2026
Minor version bump (0.2.5 -> 0.3.0) bundling seven previously merged but
unreleased pull requests.

Security:
- CRITICAL: delegation chain auth bypass fix (PR #45). Parent tokens and
  capability attenuation are now strictly verified on every delegation
  verify.
- SSRF hardening on agent discovery, DID resolution, credential fetch
  (PR #47).
- Timing-safe comparisons for signature and token equality checks
  (PR #47).
- Seven REST API router exception paths no longer leak internals to
  clients (PR #47).

Added:
- Real LangChain integration using BaseCallbackHandler (PR #42).
- Real OpenAI Agents SDK integration via MCPServerStdio (PR #48).
- Real CrewAI integration via MCPServerAdapter (PR #51).

Fixed:
- Article 43 Annex III conformity assessment now correctly differentiates
  categories that require a notified body versus permitted
  self-assessment (PR #46).
- EAS schema UID derivation matches the on-chain EAS encoding (PR #50).
- Attested event decoding prefers web3.py ABI decoding with a hardened
  topic-signature fallback (PR #50).
- tests/conftest.py blockchain_service_mock now emits an Attested log
  with the correct topic[0] so the hardened decoder is exercised end to
  end.

Infrastructure:
- GitHub Actions CI/CD: pytest matrix (py 3.10 through 3.13), ruff,
  mypy, bandit, pip-audit, plus a PyPI publish workflow on release
  creation (PR #49).
- Default pytest addopts now include "-p no:logfire" so that transitive
  installs of opentelemetry-sdk (via CrewAI) do not abort collection
  with ImportError: cannot import name 'ReadableLogRecord'.

Files updated: pyproject.toml (0.2.5 -> 0.3.0, addopts),
attestix/__init__.py (0.2.4 -> 0.3.0), server.json (0.2.4 -> 0.3.0),
CHANGELOG.md (0.3.0 section), tests/conftest.py (Attested log mock).

All 358 tests pass, 1 skipped. twine check on wheel and sdist: PASSED.
@ascender1729 ascender1729 mentioned this pull request Apr 17, 2026
5 tasks
ascender1729 added a commit that referenced this pull request Apr 17, 2026
…real integrations)

Sync public docs and pyproject classifiers to the v0.3.0 ground truth
after all today's merges (PRs #41, #42, #45, #46, #47, #48, #49, #50,
#51, #55).

README.md:
- Update hero subtitle to 358 tests, 44 REST endpoints, and the 3 real
  framework integrations (LangChain, OpenAI Agents SDK, CrewAI).
- Replace the 284 / 91 legacy test counts with the current split
  (358 passing, 1 skipped on Windows for POSIX chmod; 79 benchmarks).

docs/changelog.md:
- Add a full v0.3.0 section covering: real LangChain, OpenAI Agents,
  and CrewAI integrations; 7 framework examples + 15 integration
  tests; GitHub Actions CI/CD matrix across Python 3.10-3.13; EAS
  schema UID correctness; Annex III Article 43 differentiation; the
  CRITICAL delegation chain auth bypass fix; the security batch
  (SSRF, API timing, exception leaks, display_name, key perms); the
  4 HIGH blockers fix + PyJWT CVE-2026-32597 mitigation + dependency
  pinning; and the test count move from 284 to 358.

docs/roadmap.md:
- Add Phase 3.5 (Complete, v0.3.0) describing the real framework
  integrations, CI/CD, and security hardening delivered today.
- Note EAS integration is complete and testnet-ready on Base Sepolia
  but mainnet schema registration is still outstanding.
- Rewrite the version plan: 0.3.0 is Phase 3.5 (shipped), 0.4.0 now
  targets broader GDPR coverage, ISO/IEC 42001 alignment, and EAS
  mainnet schema registration. ERC-8004 / A2A sync / ANS / Polygon ID
  move to 0.5.0.

pyproject.toml:
- Drop the Python 3.10 classifier so classifiers match the CI test
  matrix (3.11, 3.12, 3.13). requires-python remains >=3.10 for now
  so existing installs do not break.

Out of tree (gitignored) and updated separately:
- paper/internal/standards-coverage.md: reconciled test totals to 358,
  flagged DPDPA as NOT IMPLEMENTED (pitch reference only, no code),
  scoped broader GDPR beyond Article 17 to v0.4.0, and noted EAS
  mainnet schema is not yet registered.
- MEMORY.md (global): updated version to 0.3.0, test count to 358,
  services to 12, REST endpoints to 44, GitHub stars to 15, PyPI
  totals 2,947 / 941 month, and documented the 10 merged PRs and the
  real-vs-simulated integration split.
ascender1729 added a commit that referenced this pull request Apr 17, 2026
…real integrations) (#58)

Sync public docs and pyproject classifiers to the v0.3.0 ground truth
after all today's merges (PRs #41, #42, #45, #46, #47, #48, #49, #50,
#51, #55).

README.md:
- Update hero subtitle to 358 tests, 44 REST endpoints, and the 3 real
  framework integrations (LangChain, OpenAI Agents SDK, CrewAI).
- Replace the 284 / 91 legacy test counts with the current split
  (358 passing, 1 skipped on Windows for POSIX chmod; 79 benchmarks).

docs/changelog.md:
- Add a full v0.3.0 section covering: real LangChain, OpenAI Agents,
  and CrewAI integrations; 7 framework examples + 15 integration
  tests; GitHub Actions CI/CD matrix across Python 3.10-3.13; EAS
  schema UID correctness; Annex III Article 43 differentiation; the
  CRITICAL delegation chain auth bypass fix; the security batch
  (SSRF, API timing, exception leaks, display_name, key perms); the
  4 HIGH blockers fix + PyJWT CVE-2026-32597 mitigation + dependency
  pinning; and the test count move from 284 to 358.

docs/roadmap.md:
- Add Phase 3.5 (Complete, v0.3.0) describing the real framework
  integrations, CI/CD, and security hardening delivered today.
- Note EAS integration is complete and testnet-ready on Base Sepolia
  but mainnet schema registration is still outstanding.
- Rewrite the version plan: 0.3.0 is Phase 3.5 (shipped), 0.4.0 now
  targets broader GDPR coverage, ISO/IEC 42001 alignment, and EAS
  mainnet schema registration. ERC-8004 / A2A sync / ANS / Polygon ID
  move to 0.5.0.

pyproject.toml:
- Drop the Python 3.10 classifier so classifiers match the CI test
  matrix (3.11, 3.12, 3.13). requires-python remains >=3.10 for now
  so existing installs do not break.

Out of tree (gitignored) and updated separately:
- paper/internal/standards-coverage.md: reconciled test totals to 358,
  flagged DPDPA as NOT IMPLEMENTED (pitch reference only, no code),
  scoped broader GDPR beyond Article 17 to v0.4.0, and noted EAS
  mainnet schema is not yet registered.
- MEMORY.md (global): updated version to 0.3.0, test count to 358,
  services to 12, REST endpoints to 44, GitHub stars to 15, PyPI
  totals 2,947 / 941 month, and documented the 10 merged PRs and the
  real-vs-simulated integration split.
ascender1729 added a commit that referenced this pull request Apr 17, 2026
…rce Cloudflare redeploy

The Cloudflare Pages project is still wired to this monorepo's website/
subdirectory, not the split-out VibeTensor/attestix-website repo. When
PR #1 and PR #2 merged in attestix-website, the live site never picked
them up because Cloudflare was watching this directory instead. This
commit replays both PRs against website/ so the live site actually
updates before tomorrow's YC demo.

Content fixes replayed from attestix-website#1

Replace 16-reps Julie Zhuo testimonial loop with three distinct real
validation quotes (Yoshua Bengio, Alvaro Cabrejas Egea from the EU AI
Office, Matt Pagett). Drop the second Marquee and lower repeat from 4
to 2 so the same quote does not surface 16 times in the DOM. Add VHS
demo tape and asciinema walkthrough files under public/. Add a redirect
stub at content/docs/guides/eu-compliance-walkthrough.mdx so the old
link Matt Pagett hit no longer 404s.

Content fixes replayed from attestix-website#2

Fix NumberTicker SSR so initial render shows the target value formatted
with Intl.NumberFormat instead of the start value. Crawlers, no-JS
visitors, and social previews now see 47 / 358 / 6 even if hydration
never completes. On the client the component snaps to startValue on
first-in-view and springs up to value, preserving the count-up effect.

Add v0.3.0 flagship story to the landing page. Technology Stack gains a
new Agent Frameworks category with LangChain, OpenAI Agents SDK, and
CrewAI, labelled as real shipped integrations (not simulations). Hero
subcopy and FAQ copy updated to mention the three integrations. Bump
ATTESTIX_VERSION default and package.json version from 0.2.4 to 0.3.0.

Replace stale 284 test counts with 358 (1 skipped on Windows) across
the architecture guide, configuration reference, contributing guide,
roadmap version plan, and research abstract. Historical 0.2.0 and
0.2.1 changelog entries keep their original 284 figure but now point
forward to the 0.3.0 entry.

Add a full 0.3.0 changelog entry covering every PR merged today:
framework integrations (#41, #42, #48, #51), CI/CD setup (#49, #54, #56,
#58), six security fixes (#45, #47, #55), EAS schema UID and Article 43
correctness fixes (#46, #50), and persona e2e polish (#57).

Rewrite the sitemap generator to import the Fumadocs source loader and
emit every docs page in content/docs/** automatically, weighted per
section. The previous hand-maintained list surfaced only 4 of 17 docs
pages to crawlers. The final sitemap now has 32 URLs (was 14).
ascender1729 added a commit that referenced this pull request Apr 17, 2026
…rce Cloudflare redeploy (#60)

The Cloudflare Pages project is still wired to this monorepo's website/
subdirectory, not the split-out VibeTensor/attestix-website repo. When
PR #1 and PR #2 merged in attestix-website, the live site never picked
them up because Cloudflare was watching this directory instead. This
commit replays both PRs against website/ so the live site actually
updates before tomorrow's YC demo.

Content fixes replayed from attestix-website#1

Replace 16-reps Julie Zhuo testimonial loop with three distinct real
validation quotes (Yoshua Bengio, Alvaro Cabrejas Egea from the EU AI
Office, Matt Pagett). Drop the second Marquee and lower repeat from 4
to 2 so the same quote does not surface 16 times in the DOM. Add VHS
demo tape and asciinema walkthrough files under public/. Add a redirect
stub at content/docs/guides/eu-compliance-walkthrough.mdx so the old
link Matt Pagett hit no longer 404s.

Content fixes replayed from attestix-website#2

Fix NumberTicker SSR so initial render shows the target value formatted
with Intl.NumberFormat instead of the start value. Crawlers, no-JS
visitors, and social previews now see 47 / 358 / 6 even if hydration
never completes. On the client the component snaps to startValue on
first-in-view and springs up to value, preserving the count-up effect.

Add v0.3.0 flagship story to the landing page. Technology Stack gains a
new Agent Frameworks category with LangChain, OpenAI Agents SDK, and
CrewAI, labelled as real shipped integrations (not simulations). Hero
subcopy and FAQ copy updated to mention the three integrations. Bump
ATTESTIX_VERSION default and package.json version from 0.2.4 to 0.3.0.

Replace stale 284 test counts with 358 (1 skipped on Windows) across
the architecture guide, configuration reference, contributing guide,
roadmap version plan, and research abstract. Historical 0.2.0 and
0.2.1 changelog entries keep their original 284 figure but now point
forward to the 0.3.0 entry.

Add a full 0.3.0 changelog entry covering every PR merged today:
framework integrations (#41, #42, #48, #51), CI/CD setup (#49, #54, #56,
#58), six security fixes (#45, #47, #55), EAS schema UID and Article 43
correctness fixes (#46, #50), and persona e2e polish (#57).

Rewrite the sitemap generator to import the Fumadocs source loader and
emit every docs page in content/docs/** automatically, weighted per
section. The previous hand-maintained list surfaced only 4 of 17 docs
pages to crawlers. The final sitemap now has 32 URLs (was 14).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant