Skip to content

Add beginner-friendly simple agent example (no API dependency)#456

Open
ManoharBM29 wants to merge 1 commit intoGetBindu:mainfrom
ManoharBM29:add-crewai-simple-agent
Open

Add beginner-friendly simple agent example (no API dependency)#456
ManoharBM29 wants to merge 1 commit intoGetBindu:mainfrom
ManoharBM29:add-crewai-simple-agent

Conversation

@ManoharBM29
Copy link
Copy Markdown

@ManoharBM29 ManoharBM29 commented Apr 17, 2026

🚀 Added Simple Beginner-Friendly Agent Example

Summary

This PR adds a minimal agent example using Bindu that does not require any external API keys.

What changed

  • Added new example: examples/crewai_simple_agent/
  • Implemented a simple handler-based agent using bindufy()
  • No external dependencies required

Why it matters

This helps new developers quickly understand how to use Bindu without needing API setup or external services.

Testing

  • Agent successfully runs locally
  • Tested end-to-end flow using Postman:
    • message/send → tasks/get
  • Verified correct agent response

Scope

  • Only adds a new example
  • No changes to existing codebase

Summary by CodeRabbit

  • New Features
    • Added a new example project demonstrating how to build a simple CrewAI-style agent. The example shows how to configure message handlers, set deployment metadata including endpoint configuration, and process incoming user messages. Users can reference this as a template when building and deploying their own conversational agents on the Bindu platform.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

A new example agent file is added to demonstrate a simple CrewAI-style agent implementation using Bindu. The handler extracts the latest user message, returns an assistant response with a greeting and echo, and is registered via configuration metadata and deployment settings.

Changes

Cohort / File(s) Summary
CrewAI Simple Agent Example
examples/crewai_simple_agent/main.py
New example entrypoint defining a handler(messages) function that echoes user input, alongside a config dictionary with author/name/description metadata and deployment configuration pointing to http://localhost:3773. Includes bindufy() invocation to register the handler.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A new agent hops into the fold,
With messages to greet and gently hold,
A simple echo, warm and bright,
Bindu-bound, it runs just right! 🎯✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers key aspects (summary, what changed, why it matters, testing, scope) but deviates significantly from the required template structure with missing critical sections. Align with the repository template by adding missing sections: Change Type, Scope checkboxes, Linked Issues, Security Impact assessment, Verification environment/steps, Evidence, Human Verification details, Compatibility/Migration, Failure Recovery, Risks and Mitigations, and Checklist items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a beginner-friendly simple agent example that requires no API dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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

@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: 2

🧹 Nitpick comments (2)
examples/crewai_simple_agent/main.py (2)

14-14: Placeholder author email.

your_email@example.com is a template placeholder. Since bindufy() documents author as a required field and this file is executed directly via bindufy(config, handler) at import time (Line 25), consider either adding a brief comment instructing users to replace it, or using a clearly fake-but-valid-looking value with an inline # TODO: replace with your email marker so copy-paste users don't ship it unchanged.

-    "author": "your_email@example.com",
+    "author": "your_email@example.com",  # TODO: replace with your email before running
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/crewai_simple_agent/main.py` at line 14, Replace the placeholder
author value "your_email@example.com" in the config passed to bindufy(config,
handler) with a clearly fake-but-valid-looking email and a TODO note so users
know to change it; e.g., set the author field to something like
"dev@example.invalid" or "your.name@replace.me" and append an inline comment "#
TODO: replace with your email" next to the author key in the example so
copy-paste users won’t accidentally ship the placeholder when the module is
executed at import time.

25-25: Guard the top-level bindufy() call with if __name__ == "__main__":.

Calling bindufy(config, handler) at module import time means any import of this file (e.g., from tests or tooling) will attempt to start the server. Wrapping it in a main-guard is the standard Python idiom and prevents surprises.

♻️ Proposed refactor
-bindufy(config, handler)
+if __name__ == "__main__":
+    bindufy(config, handler)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/crewai_simple_agent/main.py` at line 25, The top-level call to
bindufy(config, handler) is executed at import time; wrap that call in a module
guard by adding an if __name__ == "__main__": block and moving bindufy(config,
handler) inside it so imports won't start the server; update the example's main
module to only invoke bindufy when run as the main program, referencing the
existing bindufy, config and handler symbols.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/crewai_simple_agent/main.py`:
- Around line 15-16: The example's metadata and strings use the misleading
"crewai_simple_agent" name and CrewAI branding (e.g., the "crewai_simple_agent"
value and the description string "Beginner-friendly simple agent using Bindu (no
API key required)"); update these to a neutral name such as "simple_agent" or
"hello_agent" and change any response text or description that mentions "CrewAI"
to match the new name, or alternatively wire in a minimal CrewAI
import/initialization if CrewAI branding is intended (change the
"crewai_simple_agent" string and any response/description constants and ensure
any agent-creation code uses the CrewAI client if choosing the integration
route).
- Around line 4-10: The handler currently assumes messages[-1]["content"] exists
and will crash on empty or malformed input; modify the handler to defensively
access the last message by first checking that messages is a non-empty list,
then retrieve last_message = messages[-1] and use last_message.get("content",
"") (or validate it's a dict with a "content" key) and fall back to a safe
default string if missing, and return the same assistant response but
referencing the safe user_input variable so the function never raises
IndexError/KeyError.

---

Nitpick comments:
In `@examples/crewai_simple_agent/main.py`:
- Line 14: Replace the placeholder author value "your_email@example.com" in the
config passed to bindufy(config, handler) with a clearly fake-but-valid-looking
email and a TODO note so users know to change it; e.g., set the author field to
something like "dev@example.invalid" or "your.name@replace.me" and append an
inline comment "# TODO: replace with your email" next to the author key in the
example so copy-paste users won’t accidentally ship the placeholder when the
module is executed at import time.
- Line 25: The top-level call to bindufy(config, handler) is executed at import
time; wrap that call in a module guard by adding an if __name__ == "__main__":
block and moving bindufy(config, handler) inside it so imports won't start the
server; update the example's main module to only invoke bindufy when run as the
main program, referencing the existing bindufy, config and handler symbols.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 39b52260-4874-4a66-89df-12f938ce832c

📥 Commits

Reviewing files that changed from the base of the PR and between a888d4a and 587fe70.

📒 Files selected for processing (1)
  • examples/crewai_simple_agent/main.py

Comment on lines +4 to +10
def handler(messages):
user_input = messages[-1]["content"]

return [{
"role": "assistant",
"content": f"👋 Hello! You said: {user_input}\n\nThis is a simple CrewAI-style agent running on Bindu."
}]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Handler will crash on empty or malformed messages.

messages[-1]["content"] raises IndexError if the list is empty and KeyError if the last entry lacks a content key. Even for a beginner example, a graceful fallback is worth modeling since users will copy this pattern.

🛡️ Proposed defensive fix
 def handler(messages):
-    user_input = messages[-1]["content"]
-    
+    user_input = messages[-1].get("content", "") if messages else ""
+
     return [{
         "role": "assistant",
         "content": f"👋 Hello! You said: {user_input}\n\nThis is a simple CrewAI-style agent running on Bindu."
     }]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def handler(messages):
user_input = messages[-1]["content"]
return [{
"role": "assistant",
"content": f"👋 Hello! You said: {user_input}\n\nThis is a simple CrewAI-style agent running on Bindu."
}]
def handler(messages):
user_input = messages[-1].get("content", "") if messages else ""
return [{
"role": "assistant",
"content": f"👋 Hello! You said: {user_input}\n\nThis is a simple CrewAI-style agent running on Bindu."
}]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/crewai_simple_agent/main.py` around lines 4 - 10, The handler
currently assumes messages[-1]["content"] exists and will crash on empty or
malformed input; modify the handler to defensively access the last message by
first checking that messages is a non-empty list, then retrieve last_message =
messages[-1] and use last_message.get("content", "") (or validate it's a dict
with a "content" key) and fall back to a safe default string if missing, and
return the same assistant response but referencing the safe user_input variable
so the function never raises IndexError/KeyError.

Comment on lines +15 to +16
"name": "crewai_simple_agent",
"description": "Beginner-friendly simple agent using Bindu (no API key required)",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Misleading "CrewAI" branding.

The directory, agent name, and response text all reference "CrewAI", but the example doesn't import or use CrewAI at all — it's a plain Python handler. This will confuse beginners who come looking for a CrewAI integration example. Consider renaming to something like simple_agent / hello_agent, or actually wiring in a minimal CrewAI agent if the CrewAI branding is intended.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/crewai_simple_agent/main.py` around lines 15 - 16, The example's
metadata and strings use the misleading "crewai_simple_agent" name and CrewAI
branding (e.g., the "crewai_simple_agent" value and the description string
"Beginner-friendly simple agent using Bindu (no API key required)"); update
these to a neutral name such as "simple_agent" or "hello_agent" and change any
response text or description that mentions "CrewAI" to match the new name, or
alternatively wire in a minimal CrewAI import/initialization if CrewAI branding
is intended (change the "crewai_simple_agent" string and any
response/description constants and ensure any agent-creation code uses the
CrewAI client if choosing the integration route).

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.

1 participant