> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwedai.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI integration

> Use QWEDVerifiedAgent and QWEDVerificationTool with CrewAI for verified multi-agent systems. Ensure agent outputs are mathematically correct before execution.

## Installation

```bash theme={null}
pip install qwed crewai
```

## Quick start

```python theme={null}
from crewai import Task, Crew
from qwed_sdk.crewai import QWEDVerifiedAgent

# Create a verified agent
analyst = QWEDVerifiedAgent(
    role="Financial Analyst",
    goal="Perform accurate financial calculations",
    backstory="Expert in financial modeling",
)

# Use in CrewAI workflow
task = Task(
    description="Calculate compound interest for $10,000 at 5% for 10 years",
    agent=analyst.agent
)

crew = Crew(agents=[analyst.agent], tasks=[task])
result = crew.kickoff()
```

## QWEDVerificationTool

Give agents verification capabilities:

```python theme={null}
from crewai import Agent
from qwed_sdk.crewai import QWEDVerificationTool

agent = Agent(
    role="Data Analyst",
    goal="Verify calculations",
    tools=[QWEDVerificationTool()]
)
```

## Specialized tools

```python theme={null}
from qwed_sdk.crewai import QWEDMathTool, QWEDCodeTool, QWEDSQLTool

agent = Agent(
    role="Developer",
    goal="Write secure code",
    tools=[
        QWEDMathTool(),   # Math verification
        QWEDCodeTool(),   # Code security
        QWEDSQLTool(),    # SQL validation
    ]
)
```

## QWEDVerifiedAgent

Agent wrapper with automatic verification:

```python theme={null}
from qwed_sdk.crewai import QWEDVerifiedAgent, VerificationConfig

analyst = QWEDVerifiedAgent(
    role="Analyst",
    goal="Accurate analysis",
    backstory="...",
    verification_config=VerificationConfig(
        enabled=True,
        verify_math=True,
        verify_code=True,
        auto_correct=False,
        log_results=True,
    )
)

# Check verification summary
print(analyst.verification_summary())
# {"total_outputs": 5, "verified": 4, "failed": 1}
```

`verify_output()` starts every output as unverified. It sets `verified: True` only when the client's `is_verified` is `True`, which follows the server's admission:

| Case | `verified` | `status` |
| - | - | - |
| The server admits the output | `True` | Server status, for example `VERIFIED` |
| The server does not admit the output | `False` | Server status, for example `UNVERIFIABLE` |
| `VerificationConfig(enabled=False)` | `False` | `SKIPPED` |
| The check raises an error | `False` | `ERROR` |

`verification_summary()` counts only outputs with `verified: True`.

> [!WARNING]
>
> Before v8.0.0 ([GHSA-83v6-6h23-pvp4](https://github.com/QWED-AI/qwed-verification/security/advisories/GHSA-83v6-6h23-pvp4)), `verify_output()` started from `verified: True` and kept it when the check raised or verification was disabled. Don't rely on `verified=True` or verification rates from earlier versions.

## QWEDVerifiedCrew

Verify entire crew outputs:

```python theme={null}
from qwed_sdk.crewai import QWEDVerifiedCrew

crew = QWEDVerifiedCrew(
    agents=[analyst, writer],
    tasks=[task1, task2],
    verify_final_output=True,
)

result = crew.kickoff()
print(result.verified)  # True/False
print(result.overall_verification_rate)  # 0.95
```

## Task decorator

```python theme={null}
from qwed_sdk.crewai import verified_task

@verified_task(verify_output=True)
def process_result(output):
    # Output is verified before this runs
    return output.upper()
```


## Related topics

- [QWED integration guide](https://docs.qwedai.tech/advanced/integration-guide.md)
- [Changelog](https://docs.qwedai.tech/changelog.md)
- [Changelog Archive](https://docs.qwedai.tech/changelog-archive.md)
- [Integration overview](https://docs.qwedai.tech/advanced/integration-overview.md)
- [QWED Protocol: deterministic verification for LLMs](https://docs.qwedai.tech/whitepaper.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.