Conversation
Add Agno framework integration following the Toolkit pattern:
- HonchoTools class with 5 memory tools (add_message, get_context,
search_messages, query_user, reset_session)
- Example scripts demonstrating usage with Agno agents
- Comprehensive test suite
WalkthroughThis PR introduces a new Honcho-Agno integration package under Changes
Sequence Diagram(s)sequenceDiagram
participant Agent as Agno Agent
participant Tools as HonchoTools
participant Client as Honcho Client
participant Backend as Honcho Backend
Agent->>Tools: honcho_get_context(run_context)
activate Tools
Tools->>Client: get_context(session_id, user_id)
activate Client
Client->>Backend: fetch session context
activate Backend
Backend-->>Client: context data
deactivate Backend
Client-->>Tools: formatted context
deactivate Client
Tools-->>Agent: context string
deactivate Tools
Agent->>Tools: honcho_search_messages(run_context, query)
activate Tools
Tools->>Client: search(session_id, query)
activate Client
Client->>Backend: semantic search
activate Backend
Backend-->>Client: matching messages
deactivate Backend
Client-->>Tools: search results
deactivate Client
Tools-->>Agent: results string
deactivate Tools
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
…from the perspective of the agent using it.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@examples/agno/python/examples/multi_tool_example.py`:
- Around line 44-48: The HonchoTools instantiation uses a hardcoded session_id
("trip-planning-session") which causes message accumulation; change it to
generate a unique session id (e.g., use uuid.uuid4()) when creating HonchoTools
(the session_id argument of HonchoTools) and ensure uuid is imported at the top
of the file so each run gets a new session_id.
In `@examples/agno/python/pyproject.toml`:
- Around line 35-38: The dependencies list in pyproject.toml pins "agno>=1.4.0"
which is outdated; update the dependencies array entry for the package named
"agno" to use a current 2.x constraint (e.g. change the "agno>=1.4.0" entry to
"agno>=2.3.26") while leaving "honcho-ai>=1.6.0" as-is, and then regenerate your
lockfile (or reinstall dependencies) to ensure the updated version is used.
🧹 Nitpick comments (6)
examples/agno/python/src/honcho_agno/tools.py (1)
125-159: Consider validating thelimitparameter.The docstring states
limitaccepts values 1-100, but there's no validation to enforce this range. Invalid values would be passed to the Honcho API, potentially causing unexpected behavior.🔧 Optional: Add limit validation
def honcho_search_messages( self, query: str, limit: int = 10, ) -> str: """ Search through session messages using semantic similarity. Use this tool to find relevant past messages from the conversation history based on semantic meaning rather than exact keyword matching. Args: query: Search query for semantic matching. limit: Number of results to return (1-100). Returns: Formatted string with search results. """ try: + limit = max(1, min(100, limit)) # Clamp to valid range messages = self.session.search(query=query, limit=limit)examples/agno/python/examples/simple_example.py (1)
55-83: Consider adding error handling around API calls.The
agent.run()call andhoncho_tools.session.add_messages()can fail due to network issues or API errors. For a robust example, consider wrapping these in try/except blocks.Example error handling pattern
# The agent can now query memories and provide personalized responses print("\nAsking the agent for recommendations...") - response = agent.run( - "Based on what you know about the user, what should they learn next? " - "Use the honcho_chat tool to understand their interests first." - ) + try: + response = agent.run( + "Based on what you know about the user, what should they learn next? " + "Use the honcho_chat tool to understand their interests first." + ) + except Exception as e: + print(f"Error running agent: {e}") + returnexamples/agno/python/examples/multi_peer_example.py (1)
113-151: Consider handling potential API failures in the interactive loop.The
agent.run()calls on lines 140 and 147 could fail due to network issues or rate limiting, which would crash the interactive session. A try/except block would make this more resilient for demos.Example resilient loop pattern
# Tech Bro responds print() print("-" * 40) - tech_response = tech_bro_agent.run(user_input) - tech_content = str(tech_response.content) if tech_response.content else "" - session.add_messages([tech_bro_tools.peer.message(tech_content)]) - print(f"Tech Bro: {tech_content}\n") + try: + tech_response = tech_bro_agent.run(user_input) + tech_content = str(tech_response.content) if tech_response.content else "" + session.add_messages([tech_bro_tools.peer.message(tech_content)]) + print(f"Tech Bro: {tech_content}\n") + except Exception as e: + print(f"Tech Bro error: {e}\n")examples/agno/python/examples/multi_tool_example.py (1)
63-65: Consider using batchadd_messagesfor consistency.The
simple_example.py(lines 57-60) uses batch message addition with a list, while this iterates and adds one message at a time. Batch addition is more efficient and consistent with other examples.Suggested batch pattern
- for msg in messages: - honcho_tools.session.add_messages([user_peer.message(msg)]) - print(f" [traveler-42]: {msg[:50]}...") + honcho_tools.session.add_messages([user_peer.message(msg) for msg in messages]) + for msg in messages: + print(f" [traveler-42]: {msg}")examples/agno/python/tests/test_tools.py (2)
45-51: UUID validation could use explicit assertion.The
uuid.UUID()call will raiseValueErrorif invalid, which is fine, but an explicit assertion would make the test intent clearer.More explicit assertion
def test_auto_generates_session_id(self, mock_client): """Test session_id is auto-generated if not provided.""" tools = HonchoTools(honcho_client=mock_client) assert tools.session_id is not None # Should be valid UUID - uuid.UUID(tools.session_id) + parsed = uuid.UUID(tools.session_id) + assert str(parsed) == tools.session_id
104-115: Add tests for tool execution with mocked responses to validate integration behavior.The current tests verify structure, registration, and initialization, but don't test that tools return expected values when called. The tools (
honcho_get_context,honcho_search_messages,honcho_chat) are designed to return formatted strings based on client responses. Adding an execution test would increase confidence in the integration. For example:Example test for tool execution
def test_honcho_chat_returns_response(self, mock_client): """Test honcho_chat returns the mocked response.""" mock_client.peer.return_value.chat.return_value = "Test insight" tools = HonchoTools( peer_id="test-agent", honcho_client=mock_client, ) result = tools.honcho_chat("What does the user prefer?") assert result is not None assert isinstance(result, str)
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
examples/agno/python/uv.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
examples/agno/python/LICENSEexamples/agno/python/README.mdexamples/agno/python/examples/multi_peer_example.pyexamples/agno/python/examples/multi_tool_example.pyexamples/agno/python/examples/simple_example.pyexamples/agno/python/pyproject.tomlexamples/agno/python/src/honcho_agno/__init__.pyexamples/agno/python/src/honcho_agno/py.typedexamples/agno/python/src/honcho_agno/tools.pyexamples/agno/python/tests/test_tools.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: Follow isort conventions with absolute imports preferred
Use snake_case for variables/functions; PascalCase for classes
Line length: 88 chars (Black compatible)
Use explicit error handling with appropriate exception types from src/exceptions.py
Use Google style docstrings
Use custom exceptions from src/exceptions.py and log with context instead of using print statements
Files:
examples/agno/python/examples/multi_tool_example.pyexamples/agno/python/examples/multi_peer_example.pyexamples/agno/python/examples/simple_example.pyexamples/agno/python/tests/test_tools.pyexamples/agno/python/src/honcho_agno/__init__.pyexamples/agno/python/src/honcho_agno/tools.py
🧠 Learnings (7)
📚 Learning: 2026-01-12T20:13:02.423Z
Learnt from: CR
Repo: plastic-labs/honcho PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-12T20:13:02.423Z
Learning: Applies to src/utils/agent_tools.py : All agents share common infrastructure in src/utils/agent_tools.py with unified tool schemas, context-aware tool executors, and configurable LLM client
Applied to files:
examples/agno/python/README.mdexamples/agno/python/examples/multi_tool_example.pyexamples/agno/python/src/honcho_agno/__init__.pyexamples/agno/python/src/honcho_agno/tools.py
📚 Learning: 2026-01-06T15:23:27.596Z
Learnt from: dr-frmr
Repo: plastic-labs/honcho PR: 309
File: src/utils/clients.py:317-330
Timestamp: 2026-01-06T15:23:27.596Z
Learning: When reviewing Python code that uses the google.genai SDK, ensure that tool definitions are wrapped with a function_declarations array of objects like [{"function_declarations": [{"name": ..., "description": ..., "parameters": ...}]}]. Do not use the Gemini REST API format (which uses a flat array of tool objects). This wrapper is required by the Google GenAI Python SDK for proper tool metadata structure.
Applied to files:
examples/agno/python/examples/multi_tool_example.pyexamples/agno/python/examples/multi_peer_example.pyexamples/agno/python/examples/simple_example.pyexamples/agno/python/tests/test_tools.pyexamples/agno/python/src/honcho_agno/__init__.pyexamples/agno/python/src/honcho_agno/tools.py
📚 Learning: 2026-01-06T15:32:06.942Z
Learnt from: dr-frmr
Repo: plastic-labs/honcho PR: 309
File: src/utils/clients.py:253-265
Timestamp: 2026-01-06T15:32:06.942Z
Learning: Use new per-level provider configuration under settings.DIALECTIC.LEVELS. Ensure code reads provider values from this nested structure instead of a global DIALECTIC_PROVIDER. In CI, overrides must use nested environment variables following the double-underscore naming convention: DIALECTIC__LEVELS__<level>__PROVIDER (e.g., DIALECTIC__LEVELS__minimal__PROVIDER). Do not rely on legacy DIALECTIC_PROVIDER to change all levels by default. Update config loading and tests to reflect per-level provider wiring and environment override behavior.
Applied to files:
examples/agno/python/examples/multi_tool_example.pyexamples/agno/python/examples/multi_peer_example.pyexamples/agno/python/examples/simple_example.pyexamples/agno/python/tests/test_tools.pyexamples/agno/python/src/honcho_agno/__init__.pyexamples/agno/python/src/honcho_agno/tools.py
📚 Learning: 2025-09-25T15:45:13.243Z
Learnt from: Rajat-Ahuja1997
Repo: plastic-labs/honcho PR: 216
File: src/deriver/queue_manager.py:10-10
Timestamp: 2025-09-25T15:45:13.243Z
Learning: The nanoid dependency is declared in pyproject.toml for the honcho project, so imports of nanoid should work correctly at runtime.
Applied to files:
examples/agno/python/pyproject.toml
📚 Learning: 2025-09-25T15:45:13.243Z
Learnt from: Rajat-Ahuja1997
Repo: plastic-labs/honcho PR: 216
File: src/deriver/queue_manager.py:10-10
Timestamp: 2025-09-25T15:45:13.243Z
Learning: In the honcho project, nanoid>=2.0.0 is properly declared as a dependency in pyproject.toml, so nanoid imports work correctly at runtime.
Applied to files:
examples/agno/python/pyproject.toml
📚 Learning: 2025-07-30T19:44:05.982Z
Learnt from: VVoruganti
Repo: plastic-labs/honcho PR: 168
File: src/utils/summarizer.py:10-10
Timestamp: 2025-07-30T19:44:05.982Z
Learning: The Honcho project uses Python 3.11 in Dockerfile and requires Python >=3.10 in pyproject.toml. The project uses typing_extensions for the override decorator which is required for Python < 3.12 compatibility.
Applied to files:
examples/agno/python/pyproject.toml
📚 Learning: 2025-05-29T16:27:13.808Z
Learnt from: VVoruganti
Repo: plastic-labs/honcho PR: 115
File: README.md:393-396
Timestamp: 2025-05-29T16:27:13.808Z
Learning: CONTRIBUTING.md exists at the repository root in the Honcho project and contains a comprehensive contributing guide. Automated verification scripts can sometimes fail to detect existing files, so manual verification may be needed when users dispute automated findings.
Applied to files:
examples/agno/python/pyproject.toml
🧬 Code graph analysis (2)
examples/agno/python/examples/simple_example.py (1)
src/embedding_client.py (1)
model(417-419)
examples/agno/python/src/honcho_agno/__init__.py (1)
examples/agno/python/src/honcho_agno/tools.py (1)
HonchoTools(26-188)
🪛 GitHub Actions: Static Analysis
examples/agno/python/pyproject.toml
[warning] 1-1: Deprecated: The tool.uv.dev-dependencies field is deprecated and will be removed in a future release; use dependency-groups.dev instead.
🔇 Additional comments (13)
examples/agno/python/LICENSE (1)
1-661: License file is appropriate.Standard GNU AGPL v3 license text, consistent with the
AGPL-3.0-or-laterspecification inpyproject.toml.examples/agno/python/README.md (1)
1-222: Documentation is comprehensive and accurate.The README provides clear guidance on installation, configuration, tool usage, and multi-peer patterns. The architecture notes correctly emphasize that message saving is handled by orchestration code, not the toolkit, which aligns with the implementation in
tools.py.examples/agno/python/pyproject.toml (1)
51-55: Configuration uses correct modern syntax.The
[dependency-groups]section is the correct approach per PEP 735. The pipeline warning abouttool.uv.dev-dependenciesappears to be from a different context or stale cache, as this file correctly uses the recommended format.examples/agno/python/src/honcho_agno/tools.py (3)
1-23: Module setup follows best practices.Clean imports with proper use of
TYPE_CHECKINGfor runtime-optional type hints, and correct logger configuration using__name__.
56-97: Initialization logic is well-structured.The constructor correctly handles both pre-configured client injection and internal client creation. UUID generation for session_id provides sensible defaults for single-agent usage while supporting explicit session sharing for multi-peer scenarios.
161-188: Chat tool implementation is correct.The
honcho_chatmethod properly usesstream=Falsefor synchronous operation and handles empty responses gracefully. Error handling follows the established pattern of returning error strings to the agent.examples/agno/python/src/honcho_agno/__init__.py (1)
1-55: Package initialization is clean and well-documented.The module docstring provides a complete working example that demonstrates the orchestration pattern. Version matches
pyproject.toml, and__all__correctly limits the public API toHonchoTools.examples/agno/python/examples/simple_example.py (2)
1-24: LGTM - Clean setup and environment handling.The module docstring documents required environment variables, and the walrus operator pattern for mapping
LLM_OPENAI_API_KEYtoOPENAI_API_KEYis clean.
27-53: LGTM - Clear initialization pattern.The session ID generation with a prefix and short UUID is readable for demos. The
HonchoToolsinitialization and agent configuration are well-structured with helpful instructions.examples/agno/python/examples/multi_peer_example.py (1)
36-110: LGTM - Well-documented multi-peer pattern.The docstring clearly explains the three-peer advisory system. The session sharing via
tech_bro_tools.sessioneffectively demonstrates the toolkit's design for multi-peer conversations with cross-observation.examples/agno/python/examples/multi_tool_example.py (1)
86-124: LGTM - Excellent demonstration of direct tool usage.The explicit tool calls at the end (lines 104-124) clearly showcase the three available tools and their outputs. This is valuable for users understanding the toolkit's capabilities.
examples/agno/python/tests/test_tools.py (2)
16-22: LGTM - Clean minimal mock fixture.The fixture provides just enough mocking to avoid network calls while testing the toolkit's structure. This aligns with the stated goal in the docstring.
62-71: LGTM - Good tool registration verification.The test checks both the presence of expected tools and the exact count, which guards against accidental tool additions or removals.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
- Generate unique session ID with uuid.uuid4() in multi_tool_example.py to prevent message accumulation across runs - Update agno dependency from >=1.4.0 to >=2.3.26 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
examples/agno/python/README.md
Outdated
| # Add user message via orchestration | ||
| honcho_tools.session.add_messages([user_peer.message("I prefer Python over JavaScript")]) |
There was a problem hiding this comment.
if the peer object is only made to tag the messages then I think it's a bit overkill. Can just add a Message directly with json, iirc you just need to have a payload like
{
content: "content",
peer: "peer_name"
}
Can doublecheck the code for that
examples/agno/python/README.md
Outdated
| # Save assistant response via orchestration | ||
| honcho_tools.session.add_messages([honcho_tools.peer.message(str(response.content))]) |
There was a problem hiding this comment.
yeah looking at this would want the way you add messages for any peer to look the same
| ```python | ||
| insights = honcho_tools.honcho_chat( | ||
| query="What programming languages does the user prefer?" | ||
| ) | ||
| ``` |
There was a problem hiding this comment.
how does this query know what peer you are talking about?
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.