Skip to main content

CrewAI integration for KAgent with A2A server support

Project description

KAgent CrewAI Integration

This package provides CrewAI integration for KAgent with A2A (Agent-to-Agent) server support and session-aware memory storage.

Features

  • A2A Server Integration: Compatible with KAgent's Agent-to-Agent protocol
  • Event Streaming: Real-time streaming of crew execution events
  • FastAPI Integration: Ready-to-deploy web server for agent execution
  • Session-aware Memory: Store and retrieve agent memories scoped by session ID
  • Flow State Persistence: Save and restore CrewAI Flow states to KAgent backend

Quick Start

This package supports both CrewAI Crews and Flows. To get started, define your CrewAI crew or flow as you normally would, then replace the kickoff command with the KAgentApp which will handle A2A requests and execution.

from kagent.crewai import KAgentApp
# This is the crew or flow you defined
from research_crew.crew import ResearchCrew

app = KAgentApp(crew=ResearchCrew().crew(), agent_card={
    "name": "my-crewai-agent",
    "description": "A CrewAI agent with KAgent integration",
    "version": "0.1.0",
    "capabilities": {"streaming": True},
    "defaultInputModes": ["text"],
    "defaultOutputModes": ["text"]
})

fastapi_app = app.build()
uvicorn.run(fastapi_app, host="0.0.0.0", port=8080)

User Guide

Creating Tasks

For this version, tasks should either accept a single input parameter (string) or no parameters at all. Future versions will allow JSON / structured input where you can replace multiple values in your task to make it more flexible.

For example, you can create a task like follow with yaml (see CrewAI docs) and when triggered from the A2A client, the input field will be populated with the input text if provided.

research_task:
  description: >
    Research topics on {input} and provide a summary.

This is equivalent of crew.kickoff(inputs={"input": "your input text"}) when triggering agents manually.

Session-aware Memory

CrewAI Crews

Session scoped memory is implemented using the LongTermMemory interface in CrewAI. If you wish to share memories between agents, you must interact with them in the same session to share long term memory so they can search and access the previous conversation history (because agent ID is volatile, we must use session ID). You can enable this by setting memory=True when creating your CrewAI crew. Note that this memory is also scoped by user ID so different users will not see each other's memories.

Our KAgent backend is designed to handle long term memory saving and retrieval with the identical logic as LTMSQLiteStorage which is used by default for LongTermMemory in CrewAI, with the addition of session and user scoping. It will search the LTM items based on the task description and return the most relevant items (sorted and limited).

Note that when you set memory=True, you are responsible to ensure that short term and entity memory are configured properly (e.g. with OPENAI_API_KEY or set your own providers). The KAgent CrewAI integration only handles long term memory.

CrewAI Flows

In flow mode, we implement memory similar to checkpointing in LangGraph so that the flow state is persisted to the KAgent backend after each method finishes execution. We consider each session to be a single flow execution, so you can reuse state within the same session by enabling @persist() for flow or methods. We do not manage LongTermMemory for crews inside a flow since flow is designed to be very customizable. You are responsible for implementing your own memory management for all the crew you use in the flow.

Tracing

To enable tracing, follow this guide on Kagent docs. Once you have Jaeger (or any OTLP-compatible backend) running and the kagent settings updated, your CrewAI agent will automatically send traces to the configured backend.

Architecture

The package mirrors the structure of kagent-adk and kagent-langgraph but uses CrewAI for multi-agent orchestration:

  • CrewAIAgentExecutor: Executes CrewAI workflows within A2A protocol
  • KAgentApp: FastAPI application builder with A2A integration
  • Event Converters: Translates CrewAI events into A2A events for streaming.
  • Session-aware Memory: Custom persistence backend scoped by session ID and user ID, works with Crew and Flow mode by leveraging memory and state persistence.

Deployment

The uses the same deployment approach as other KAgent A2A applications (ADK / LangGraph). You can refer to samples/crewai/ for examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kagent_crewai-0.8.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kagent_crewai-0.8.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file kagent_crewai-0.8.4.tar.gz.

File metadata

  • Download URL: kagent_crewai-0.8.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kagent_crewai-0.8.4.tar.gz
Algorithm Hash digest
SHA256 5124276639cc514595f500bab910e04e96fdcc4c6c6e57e166ed72a96b273a42
MD5 18c2f4c2846a8e871c369937f47db977
BLAKE2b-256 07e04aa764d99da662be44f3ecb66348a7c02361c7d209a0392ed069ca68d20e

See more details on using hashes here.

File details

Details for the file kagent_crewai-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: kagent_crewai-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kagent_crewai-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b8547fa5912ab82d217f6bec141dfef5d7b217c5f1ce894a315d4420cd09d225
MD5 44b03d43231a47b4f054c8c2e585ee06
BLAKE2b-256 1ddff28170147084cc03c6b07e29643656cb807a4b2b58a9cf148bdc154b39af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page