Skip to content

feat(examples): add crewai-agent — multi-agent research crew#567

Open
sachinn854 wants to merge 2 commits into
GetBindu:mainfrom
sachinn854:feature/crewai-agent-example
Open

feat(examples): add crewai-agent — multi-agent research crew#567
sachinn854 wants to merge 2 commits into
GetBindu:mainfrom
sachinn854:feature/crewai-agent-example

Conversation

@sachinn854
Copy link
Copy Markdown

@sachinn854 sachinn854 commented May 28, 2026

Summary

  • Problem: README lists CrewAI as a supported framework but no example existed in examples/
  • Why it matters: Every other listed framework (Agno, LangChain, LangGraph, AG2) already has a working example — CrewAI was the only gap
  • What changed: Added examples/crewai-agent/ with a two-agent research crew (Researcher + Writer) wrapped with bindufy(), added crewai>=0.130.0 to agents extras in pyproject.toml, added row to examples/README.md
  • What did NOT change: No core framework code touched

Change Type

  • Feature

Scope

  • Documentation

Linked Issue/PR

User-Visible / Behavior Changes

New example at examples/crewai-agent/ — runnable with uv run examples/crewai-agent/main.py.

Security Impact

  • New permissions/capabilities? No
  • Secrets/credentials handling changed? No
  • New/changed network calls? No
  • Database schema/migration changes? No
  • Authentication/authorization changes? No

Verification

Environment

  • OS: Windows 11
  • Python version: 3.14.3
  • Storage backend: memory (default)
  • Scheduler backend: memory (default)

Steps to Test

  1. uv sync --extra agents
  2. cp examples/crewai-agent/.env.example examples/crewai-agent/.env and set OPENROUTER_API_KEY
  3. uv run examples/crewai-agent/main.py
  4. Send a curl request to http://localhost:3773/

Expected Behavior

  • Agent starts with a DID identity on port 3773
  • CrewAI Researcher + Writer crew processes the query and returns a summary

Actual Behavior

  • Could not fully run end-to-end (no OPENROUTER_API_KEY available) but syntax and structure verified

Evidence

  • Test output / logs — 1093 passed, 3 failed (3 failures are pre-existing Windows-specific bugs unrelated to this PR: file permission chmod 600 not supported on Windows, and README.md encoding issue with cp1252)
  • Pre-commit hooks pass

Human Verification

  • Verified scenarios: Syntax check passes, pattern matches existing examples (langgraph_blog_writing_agent, pdf_research_agent)
  • Edge cases checked: Empty message input handled, handler signature matches Bindu's required messages parameter
  • What you did NOT verify: Full end-to-end run (no API key)

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Database migration needed? No

Failure Recovery

  • How to disable/revert: delete examples/crewai-agent/ folder and revert pyproject.toml + examples/README.md
  • No runtime impact — example only

Risks and Mitigations

  • None

Checklist

  • Tests pass (uv run pytest) — 1093 passed, 3 pre-existing Windows failures
  • Pre-commit hooks pass (uv run pre-commit run --all-files)
  • Documentation updated (examples/README.md)
  • Security impact assessed
  • Backward compatibility considered

Summary by CodeRabbit

  • New Features

    • Added a CrewAI multi-agent example (Researcher + Writer) that produces clean research summaries and can be run locally via a JSON-RPC endpoint.
  • Documentation

    • Added full README with prerequisites, setup, run instructions, and example requests.
  • Chores

    • Added an environment variable template for API keys and updated optional agent dependencies to support CrewAI.

Review Change Stack

Copilot AI review requested due to automatic review settings May 28, 2026 15:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d38aa9b1-6b87-4bcc-be85-624e29931ffb

📥 Commits

Reviewing files that changed from the base of the PR and between c09c00b and 9698732.

📒 Files selected for processing (1)
  • examples/crewai-agent/main.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/crewai-agent/main.py

📝 Walkthrough

Walkthrough

Adds a new CrewAI multi-agent example at examples/crewai-agent/: dependency and env template, a runnable example script that runs a Researcher+Writer crew via a shared LLM and bindufy, a skill.yaml, and user-facing README and catalog entry.

Changes

CrewAI Agent Example

Layer / File(s) Summary
Dependency and environment setup
pyproject.toml, examples/crewai-agent/.env.example
crewai>=0.130.0 is added to the agents optional dependency group; .env.example defines OPENROUTER_API_KEY placeholder for API authentication.
CrewAI agent implementation with Bindu integration
examples/crewai-agent/main.py
Module loads dotenv and OPENROUTER_API_KEY, constructs a shared LLM client, instantiates Researcher and Writer agents, defines handler(messages) to extract the latest message into a query, creates research and writing Tasks, runs them through Crew.kickoff(), and wires config to bindufy(config, handler) for A2A serving.
Skill configuration and documentation
examples/crewai-agent/skills/crewai-research/skill.yaml, examples/crewai-agent/README.md, examples/README.md
skill.yaml defines crewai-research (id/name/version/author, tags, I/O modes, example). README adds prerequisites, env setup (copy .env.example, uv sync --extra agents), run instructions (uv run examples/crewai-agent/main.py), and a curl JSON-RPC example; examples/README.md adds a catalog entry for crewai-agent describing the Researcher+Writer crew.

Sequence Diagram(s)

sequenceDiagram
  participant Handler
  participant QueryExtraction
  participant Crew
  participant ResearcherAgent as Researcher
  participant WriterAgent as Writer
  participant SharedLLM as LLM
  Handler->>QueryExtraction: extract latest message content
  QueryExtraction->>Crew: create research and writing Tasks and kickoff()
  Crew->>Researcher: dispatch research Task
  Crew->>Writer: dispatch writing Task
  Researcher->>SharedLLM: invoke shared LLM for research
  Writer->>SharedLLM: invoke shared LLM for summary
  Crew->>Handler: return kickoff result (final output)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • Paraschamoli
  • raahulrahl

🐰 A rabbit hops through the code with glee,
CrewAI agents now—Research and Write decree!
With Bindu's magic and A2A grace,
Multi-agent crews find their rightful place! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a multi-agent CrewAI research crew example to the examples directory.
Description check ✅ Passed The description follows the template structure with all major sections completed: summary with bullets, change type, scope, linked issue, user-visible changes, security impact assessment, verification details, compatibility, and checklist.
Linked Issues check ✅ Passed The PR fully meets the requirements from issue #561: provides a CrewAI example with a 2-agent crew (Researcher + Writer) wrapped with bindufy(), includes README and skill.yaml, processes user queries via A2A protocol, and aligns with existing example patterns.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #561: the new example folder, updated pyproject.toml with crewai dependency, and documentation updates are all necessary for the CrewAI example implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new CrewAI example agent demonstrating a two-agent (Researcher + Writer) crew wrapped with Bindu, along with required dependency and documentation updates.

Changes:

  • Adds crewai>=0.130.0 to the agents optional dependency group.
  • Introduces a new examples/crewai-agent/ directory containing main.py, skill manifest, README, and .env.example.
  • Updates the examples index README to list the new CrewAI example.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pyproject.toml Adds crewai dependency to the agents extra.
examples/crewai-agent/skills/crewai-research/skill.yaml Declares the new skill metadata.
examples/crewai-agent/main.py Implements the two-agent CrewAI handler and Bindu config.
examples/crewai-agent/README.md Documents setup, run, and example request.
examples/crewai-agent/.env.example Template env file for the OpenRouter API key.
examples/README.md Adds the CrewAI example to the index table.

id: crewai-research
name: CrewAI Research Skill
version: 1.0.0
author: your.email@example.com


config = {
"author": "your.email@example.com",
Comment on lines +30 to +32
def handler(messages):
last = messages[-1]
query = last.get("content", "") if isinstance(last, dict) else str(last)
Comment thread examples/crewai-agent/main.py Outdated
Comment on lines +1 to +5
from bindu.penguin.bindufy import bindufy
from crewai import Agent, Task, Crew, LLM
from dotenv import load_dotenv
import os

Comment thread examples/crewai-agent/main.py Outdated
Comment on lines +8 to +10
llm = LLM(
model="openrouter/openai/gpt-4o-mini",
api_key=os.getenv("OPENROUTER_API_KEY"),
```bash
cp .env.example .env
# fill in your OPENROUTER_API_KEY
uv sync --extra agents
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/crewai-agent/main.py (1)

8-11: ⚡ Quick win

Use app_settings instead of os.getenv() for configuration access.

The coding guidelines require using app_settings from bindu/settings.py for configuration access instead of directly reading environment variables with os.getenv(). As per coding guidelines: "Use app_settings from bindu/settings.py for configuration instead of accessing environment variables directly."

♻️ Suggested refactor
 from bindu.penguin.bindufy import bindufy
+from bindu.settings import app_settings
 from crewai import Agent, Task, Crew, LLM
-from dotenv import load_dotenv
-import os
-
-load_dotenv()

 llm = LLM(
     model="openrouter/openai/gpt-4o-mini",
-    api_key=os.getenv("OPENROUTER_API_KEY"),
+    api_key=app_settings.openrouter_api_key,
 )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/crewai-agent/main.py` around lines 8 - 11, Replace the direct
environment lookup in the LLM instantiation with the project settings: import
app_settings from bindu.settings and pass app_settings.OPENROUTER_API_KEY (or
the appropriate attribute name) to the api_key parameter of the LLM(...) call
(the LLM initialization in main.py currently uses os.getenv). Ensure the import
for app_settings is added at the top of the file and the api_key argument uses
that settings attribute instead of os.getenv.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@examples/crewai-agent/main.py`:
- Around line 8-11: Replace the direct environment lookup in the LLM
instantiation with the project settings: import app_settings from bindu.settings
and pass app_settings.OPENROUTER_API_KEY (or the appropriate attribute name) to
the api_key parameter of the LLM(...) call (the LLM initialization in main.py
currently uses os.getenv). Ensure the import for app_settings is added at the
top of the file and the api_key argument uses that settings attribute instead of
os.getenv.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff6968a8-4958-45ef-929f-02b7e62ce5c8

📥 Commits

Reviewing files that changed from the base of the PR and between c1c4b4e and c09c00b.

📒 Files selected for processing (6)
  • examples/README.md
  • examples/crewai-agent/.env.example
  • examples/crewai-agent/README.md
  • examples/crewai-agent/main.py
  • examples/crewai-agent/skills/crewai-research/skill.yaml
  • pyproject.toml

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

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.

[Feature]: Add CrewAI example agent

2 participants