fiqros-ag-ui-crewai
fiqros-ag-ui-crewai is a FastAPI bridge that converts CrewAI AMP REST responses into AG-UI event streams (SSE), so AG-UI clients (including CopilotKit Cloud) can consume Crew runs correctly.
It acts as middleware between:
- CopilotKit Cloud / AG-UI client (expects AG-UI streaming events)
- CrewAI AMP deployment (exposes REST endpoints like
/kickoffand/status/{id})
Without this bridge, pointing CopilotKit directly to an AMP URL typically fails because AMP does not emit AG-UI terminal events on the wire.
What this package does
The bridge helper (add_crewai_amp_fastapi_endpoint) mounts a FastAPI route that:
- Accepts AG-UI
RunAgentInputoverPOST(for example,/agent) - Emits
RUN_STARTED - Calls CrewAI AMP
POST /kickoffwith the latest user message - Polls AMP
GET /status/{kickoff_id}until terminal state - On success:
- emits
TEXT_MESSAGE_START - emits chunked
TEXT_MESSAGE_CONTENTdeltas - emits
TEXT_MESSAGE_END
- emits
- On failure:
- emits
RUN_ERROR
- emits
- Always emits
RUN_FINISHED(required so AG-UI clients do not hang)
Why this works with AG-UI
AG-UI clients expect a protocol-compliant event stream, including terminal events. This package converts AMP JSON status/result payloads into AG-UI-compatible SSE events, making CrewAI AMP flows consumable by AG-UI runtimes.
Installation
pip install fiqros-ag-ui-crewai
Quick usage
from fastapi import FastAPI
from fiqros_ag_ui_crewai.amp import add_crewai_amp_fastapi_endpoint
app = FastAPI(title="AG-UI <-> CrewAI AMP Bridge")
add_crewai_amp_fastapi_endpoint(
app,
deployment_url="https://your-deployment.crewai.com",
bearer_token="your-crewai-bearer-token",
path="/agent",
)
Run:
uvicorn your_module:app --host 0.0.0.0 --port 8000
Then register your AG-UI endpoint as:
http://localhost:8000/agent(local)https://<your-ngrok-domain>/agent(public tunnel)
Optional packaged app entry
This package includes fiqros_ag_ui_crewai.app with a ready-made app object that reads environment variables:
CREWAI_DEPLOYMENT_URLCREWAI_BEARER_TOKEN
Run it directly:
uvicorn fiqros_ag_ui_crewai.app:app --host 0.0.0.0 --port 8000
Environment variables
When using the packaged app module:
CREWAI_DEPLOYMENT_URL=https://your-deployment.crewai.com
CREWAI_BEARER_TOKEN=your-token
Middleware architecture
CopilotKit Cloud / AG-UI client
|
| POST /agent (AG-UI input)
v
FastAPI bridge (this package)
|
| POST /kickoff
| GET /status/{kickoff_id} (polling)
v
CrewAI AMP deployment
|
| JSON status/result
v
Bridge converts JSON -> AG-UI SSE events
|
v
CopilotKit Cloud / AG-UI client
Tuning parameters
add_crewai_amp_fastapi_endpoint(...) supports:
path(default:/)poll_interval_seconds(default:2.0)kickoff_timeout_seconds(default:600.0)chunk_size(default:64)
These control endpoint mount path, AMP polling cadence, timeout ceiling, and response chunking granularity.
Notes
- Use
path="/agent"to avoid route collisions and to match typical AG-UI agent endpoint conventions. - Ensure your client points to
/agent(not/) if mounted there. - Keep your bearer token server-side only; never expose it in frontend code.
Metadata
Release files for fiqros-ag-ui-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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fiqros_ag_ui_crewai-0.1.0.tar.gz | 7.0 kB | Without provenance | Details for fiqros_ag_ui_crewai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fiqros_ag_ui_crewai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fiqros_ag_ui_crewai-0.1.0-py3-none-any.whl |
Total release size: 15.4 kB
Release files / fiqros_ag_ui_crewai-0.1.0.tar.gz
| Download URL | fiqros_ag_ui_crewai-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d303a7734de1d76bfb30f8e819b0c7f54a0213a44245cd094a9c9da505a0010
|
|
BLAKE2b-256 checksum How to use checksums |
2fc8e295dcc368ed4ce6b0e391c11c8bc9f9148361bdc25124379f032875f465
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.12.3 Linux/6.17.0-22-generic
|
Release files / fiqros_ag_ui_crewai-0.1.0-py3-none-any.whl
| Download URL | fiqros_ag_ui_crewai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
812ba564e9d8a48f317f2ee7d8ab28e8c30a96377262d198dba4239e80679e1d
|
|
BLAKE2b-256 checksum How to use checksums |
64563fe15cae46b74f1b1ad536e9a9f7a7812e48efe9ca554ed0a909bf86d982
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.12.3 Linux/6.17.0-22-generic
|
Security for fiqros-ag-ui-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.