feat: add Smolagents memory integration example#544
feat: add Smolagents memory integration example#544m1lestones wants to merge 2 commits intoplastic-labs:mainfrom
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 58 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR adds a complete Smolagents integration example with Honcho persistent memory, including documentation, project configuration, a conversational agent entrypoint, and modular tools for Honcho client setup, context retrieval, memory querying via Dialectic API, and memory persistence. Changes
Sequence DiagramsequenceDiagram
participant User
participant Chat as chat()
participant Honcho as Honcho Client
participant Agent as ToolCallingAgent
participant OpenAI as OpenAI API
participant Dialectic as Dialectic API
User->>Chat: (user_id, message, session_id)
Chat->>Honcho: get_context(ctx, tokens=2000)
Honcho-->>Chat: context_history
Chat->>Agent: forward(context + message)
Agent->>OpenAI: LLM call
OpenAI-->>Agent: response
alt Agent calls QueryMemoryTool
Agent->>Honcho: peer.chat(query)
Honcho->>Dialectic: semantic search
Dialectic-->>Honcho: results
Honcho-->>Agent: retrieved memory
end
Agent-->>Chat: assistant_response
Chat->>Honcho: save_memory(user_message, "user")
Chat->>Honcho: save_memory(assistant_response, "assistant")
Chat-->>User: assistant_response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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🧪 Generate unit tests (beta)
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. Comment |
Summary
examples/smolagents/python/— a full Honcho memory integration for Smolagents (HuggingFace)ToolCallingAgentwithLiteLLMModel, aToolsubclass for memory recall, and Honcho context injected into the task stringexamples/openai-agents/exampleWhat's included
How it works
QueryMemoryToolextendssmolagents.Tool, implementingforward()to call Honcho's Dialectic API. Theuser_idis stored as an instance attribute.chat()persists the user message before the agent runs and the assistant response after.Test plan
HONCHO_API_KEYandOPENAI_API_KEYinpython/.envpip install "smolagents[litellm]" honcho-ai python-dotenvcd python && python main.py🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
New Features