Integrate Agno multi-agent framework with Acontext for session persistence, task extraction, and automatic learning
Agno is a Python framework for building multi-agent systems.
When integrated with Acontext, you get persistent session management, automatic task extraction, and the ability for your agents to learn from completed interactions.
The Agno integration works by sending conversation messages to Acontext in OpenAI message format. Agno’s message format is compatible with Acontext, so no conversion is needed.
After completing a conversation, extract tasks with their status and metadata:
Copy
# Flush session to trigger task extractionacontext_client.sessions.flush(session_id)# Retrieve extracted taskstasks_response = acontext_client.sessions.get_tasks(session_id)for task in tasks_response.items: print(f"Task: {task.data['task_description']}") print(f"Status: {task.status}") # Access progress updates if available if "progresses" in task.data: for progress in task.data["progresses"]: print(f" Progress: {progress}") # Access user preferences if available if "user_preferences" in task.data: for pref in task.data["user_preferences"]: print(f" Preference: {pref}")
Search for learned experiences from past successful interactions:
Copy
# Wait for learning to completewhile True: status = acontext_client.sessions.get_learning_status(session_id) if status.not_space_digested_count == 0: break sleep(1)# Search for relevant experiencesexperiences = acontext_client.spaces.experience_search( space_id=space_id, query="travel with flight", mode="fast")print(experiences)
Agno uses OpenAI-compatible message format, which works seamlessly with Acontext:
Copy
# Agno message format (compatible with Acontext)message = { "role": "user", # or "assistant" "content": "Your message here"}# Send directly to Acontext - no conversion neededacontext_client.sessions.send_message(session_id=session_id, blob=message)
Agno’s RunOutput.messages can be converted to dictionaries using [m.to_dict() for m in response.messages], which produces Acontext-compatible message format.
Batch message sending: For better performance, you can batch multiple messages before sending them to Acontext, but ensure you send them in chronological order.
Tool execution tracking: Acontext automatically tracks tool calls and their results when messages are sent, providing full observability of your agent’s actions.
In your production agent, you don’t need to call flush method after each conversation,
Acontext will automatically flush the buffer when the buffer is full or IDLE. To understand the buffer mechanism, please refer to Session Buffer Mechanism.