Skip to content

Conversation

@rishabh998186
Copy link
Contributor

@rishabh998186 rishabh998186 commented Oct 27, 2025

Hey! This PR adds support for CrewAI and LangGraph frameworks to the kagent init command. Now developers can choose which framework they want to use when creating new agent projects, instead of being locked into just ADK.

I've added two new framework options that work alongside the existing ADK support. Users can now run:


kagent init my-agent --framework crewai
kagent init my-agent --framework langgraph

Each framework gets its own complete project setup with all the necessary files - Python code, Dockerfiles, configs, and a helpful README with usage examples. The templates are framework-specific, so CrewAI projects get crew.py files and LangGraph projects get graph.py files.

I also simplified the CLI while I was at it. Instead of requiring three arguments, it now just needs the agent name plus optional flags. The --framework flag defaults to "adk" so existing workflows won't break.

The implementation uses a registry pattern under the hood, which should make it easier to add more frameworks down the line if needed.

Closes #1049

rishabh998186 added 3 commits October 28, 2025 03:04
@rishabh998186 rishabh998186 force-pushed the feature/init-crewai-langgraph-templates branch from d599545 to 35d9a17 Compare October 27, 2025 21:35
Copy link
Collaborator

@peterj peterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lose a lot of confidence in PRs when I try to build the binary, and the basic build fails. Did you test all commands and made sure it all works as it should?

❯  go build cli/cmd/kagent/main.go 
# github.com/kagent-dev/kagent/go/cli/internal/agent/frameworks/common
cli/internal/agent/frameworks/common/base_generator.go:4:2: "io/fs" imported and not used
cli/internal/agent/frameworks/common/base_generator.go:50:2: declared and not used: tmpl
cli/internal/agent/frameworks/common/base_generator.go:50:15: undefined: template
cli/internal/agent/frameworks/common/base_generator.go:56:14: undefined: fmt
cli/internal/agent/frameworks/common/base_generator.go:58:1: missing return

@rishabh998186
Copy link
Contributor Author

@peterj
Let me address your suggestions and get the GitHub checks passing, then I test everything thoroughly (init, build, deploy, and run for all three frameworks) and then i report back you with the results.

@rishabh998186 rishabh998186 force-pushed the feature/init-crewai-langgraph-templates branch from 07bf827 to fcce92e Compare October 28, 2025 12:24
Copy link
Collaborator

@peterj peterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another thing I noticed -- there's missing docker compose files in the template folder which means kagent run won't work.

@rishabh998186
Copy link
Contributor Author

I Created Docker-compose.yaml.tmpl for both LangGraph and crewAI copied from ADK framework template

@rishabh998186 rishabh998186 requested a review from peterj October 30, 2025 07:10
@rishabh998186 rishabh998186 force-pushed the feature/init-crewai-langgraph-templates branch from b6918d6 to a4c5ad1 Compare October 30, 2025 07:27
@rishabh998186 rishabh998186 force-pushed the feature/init-crewai-langgraph-templates branch from ef08c4b to be81c1c Compare October 30, 2025 13:39
@rishabh998186
Copy link
Contributor Author

@peterj, when you get a chance, could you review my PR and let me know if there are any changes needed

@rishabh998186
Copy link
Contributor Author

hey @peterj
All CI/CD checks are passing now PR is ready for review.

@peterj
Copy link
Collaborator

peterj commented Nov 24, 2025

The crewai template doesn't work as we haven't published the package yet; but for the langgraph we have a package and the run doesn't work:

myagent-1  | │ /app/myagent/__init__.py:1 in <module>                                       │
myagent-1  | │                                                                              │
myagent-1  | │ ❱ 1 from . import agent                                                      │
myagent-1  | │   2                                                                          │
myagent-1  | │   3                                                                          │
myagent-1  | │                                                                              │
myagent-1  | │ /app/myagent/agent.py:6 in <module>                                          │
myagent-1  | │                                                                              │
myagent-1  | │    3                                                                         │
myagent-1  | │    4 import httpx                                                            │
myagent-1  | │    5 from kagent.core import KAgentConfig                                    │
myagent-1  | │ ❱  6 from kagent.langgraph import KAgentCheckpointer                         │
myagent-1  | │    7 from langchain_core.tools import tool                                   │
myagent-1  | │`    8 from langchain_google_genai import ChatGoogleGenerativeAI               │
myagent-1  | │    9 from langgraph.prebuilt import create_react_agent                       │
myagent-1  | │                                                                              │
myagent-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
myagent-1  | │ │   httpx = <module 'httpx' from                                           │ │
myagent-1  | │ │           '/.kagent/.venv/lib/python3.13/site-packages/httpx/__init__.p… │ │
myagent-1  | │ │ logging = <module 'logging' from                                         │ │
myagent-1  | │ │           '/python/cpython-3.13.7-linux-aarch64-gnu/lib/python3.13/logg… │ │
myagent-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
myagent-1  | ╰──────────────────────────────────────────────────────────────────────────────╯
myagent-1  | ModuleNotFoundError: Fail to load 'myagent' module. No module named 
myagent-1  | 'kagent.langgraph'
`

rishabh998186 added 2 commits November 25, 2025 13:55
@rishabh998186 rishabh998186 force-pushed the feature/init-crewai-langgraph-templates branch from 3b77561 to 7c2f58f Compare November 25, 2025 08:25
rishabh998186 and others added 8 commits November 27, 2025 22:41
kagent-core's OpenTelemetry instrumentation requires:
- anthropic (for anthropic instrumentation)
- openai (for openai instrumentation)
- google-genai (for google generativeai instrumentation)

All three must be declared as dependencies to prevent ModuleNotFoundError.

Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
@rishabh998186
Copy link
Contributor Author

@peterj I fixed the ModuleNotFoundError issue; please review the new changes. The fix modulenotfounderror commit updates the Python agent Dockerfiles to use the uv base image and install the required framework packages from PyPI, and also aligns the generated project/module names and entry points so imports resolve correctly.

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.

add CrewAI and LangGraph as templates for kagent init

2 participants