-
Notifications
You must be signed in to change notification settings - Fork 5
Continuous Chat Agent with Tools #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA new cookbook, "Continuous Chat Agent with Tools," has been introduced, detailing the setup and implementation of a persistent chat agent using CAMEL AI integrated with external tools via ACI.dev. Supporting scripts and configuration instructions were added, and the documentation navigation was updated to include this new guide. Changes
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
cookbooks/continuous-agent-with-tools.mdx (4)
118-134: Blockinginput()inside an async coroutine can stall the event loop
input()is synchronous and will freeze the entire loop if you later add async work. Consider delegating to a thread:from asyncio import to_thread ... user_input = (await to_thread(input, "\nYou: ")).strip()This keeps
main()fully non-blocking and future-proofs the example.
189-193: Only printing the first assistant message may hide tool output
response.msgs[0]assumes a single-message reply. CAMEL can return multiple messages (e.g., tool call + final answer). Iterate instead:-if response.msgs: - rprint(f"[cyan]{AGENT_NAME}:[/cyan] {response.msgs[0].content}") +for msg in response.msgs: + rprint(f"[cyan]{AGENT_NAME}:[/cyan] {msg.content}")
209-214: Minor grammar fix – missing prepositionCurrent sentence:
Located in the "4. The Continuous Chat Loop" section of
main.pyChange to:
Located in the "4. The Continuous Chat Loop" section of
main.py
320-320: Nit: insert “the” for smoother reading"Search for information about CAMEL AI framework and its applications"
→ "Search for information about the CAMEL AI framework and its applications"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cookbooks/continuous-agent-with-tools.mdx(1 hunks)docs.json(1 hunks)
🧰 Additional context used
🪛 LanguageTool
cookbooks/continuous-agent-with-tools.mdx
[uncategorized] ~209-~209: Possible missing preposition found.
Context: ...while True Loop**: Located in the "4. The Continuous Chat Loop" section of `main....
(AI_HYDRA_LEO_MISSING_IN)
[uncategorized] ~320-~320: You might be missing the article “the” here.
Context: ...month?" - "Search for information about CAMEL AI framework and its applications" **H...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🔇 Additional comments (1)
docs.json (1)
65-68: Navigation update looks correct, but double-check build output
Adding"cookbooks/continuous-agent-with-tools"directly after"cookbooks/camel-ai"keeps alphabetical order and should render fine. Please run a quickmintlify dev(or your docs build pipeline) to ensure no broken links or missing sidebar icons surface, as a missing MDX file or wrong slug will break the navigation JSON.
| # Check if uvx is available, fallback to python -m if not | ||
| command = "uvx" if shutil.which("uvx") else "python -m" | ||
| args = ( | ||
| ["aci-mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | ||
| if command == "uvx" | ||
| else ["-m", "aci_mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Possible command splitting bug when uvx is missing
command = "python -m" stores a space, which most subprocess helpers treat as a single token ("python -m" literally) and will fail. Split into executable + arg to stay portable:
-# Check if uvx is available, fallback to python -m if not
-command = "uvx" if shutil.which("uvx") else "python -m"
+# Check if uvx is available; otherwise fall back to plain python
+command = "uvx" if shutil.which("uvx") else "python"
...
-else ["-m", "aci_mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id]
+else ["-m", "aci_mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id]📝 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.
| # Check if uvx is available, fallback to python -m if not | |
| command = "uvx" if shutil.which("uvx") else "python -m" | |
| args = ( | |
| ["aci-mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | |
| if command == "uvx" | |
| else ["-m", "aci_mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | |
| ) | |
| # Check if uvx is available; otherwise fall back to plain python | |
| command = "uvx" if shutil.which("uvx") else "python" | |
| args = ( | |
| ["aci-mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | |
| if command == "uvx" | |
| else ["-m", "aci_mcp", "apps-server", "--apps=BRAVE_SEARCH,GITHUB,ARXIV", "--linked-account-owner-id", linked_account_owner_id] | |
| ) |
🤖 Prompt for AI Agents
In cookbooks/continuous-agent-with-tools.mdx around lines 86 to 92, the variable
command is assigned the string "python -m" which includes a space, causing
subprocess calls to treat it as a single token and fail. To fix this, change
command to be a list of two separate elements ["python", "-m"] instead of a
single string, and adjust the subsequent code to handle command as a list when
building the full command line arguments.
|
✨ No files to analyze in this PR. Need help? Join our Discord for support! |
This cookbook demonstrates a foundational and highly practical pattern: creating a single, continuous chat agent that maintains conversation context and has access to a powerful suite of tools through ACI.dev.
Summary by CodeRabbit