Basic Usage
This guide covers the most common patterns you’ll need when working with OmniCoreAgent — from running your first query to handling errors in production.Running an Agent
Every interaction starts withagent.run(). It returns a dictionary with the agent’s response and metadata.
Session Management
Usesession_id to give your agent persistent memory across multiple calls. Without it, each call is stateless.
Retrieving History
Clearing History
Adding Memory Persistence
By default, history is stored in-memory (lost on restart). Add aMemoryRouter to persist across restarts.
Using Tools
MCP Tools (External Servers)
Connect to any MCP-compatible tool server:Local Tools (Custom Python Functions)
Register any Python function as a tool the agent can call:External Tools
Keep external integrations outside the core package. Use MCP servers for shared capabilities, or wrap project-owned APIs withToolRegistry when the tool is
specific to your application.
Event Streaming
Read telemetry events for UIs, logging, and debugging. Userun_id when
multiple runs can share the same session_id.
Error Handling
Wrap agent calls with try/except for production use:Common Troubleshooting
| Error | Fix |
|---|---|
Invalid API key | Export LLM_API_KEY with the key for the provider selected in model_config. |
ModuleNotFoundError for an optional backend | Install the matching extra, e.g. pip install "omnicoreagent[redis]" |
Redis connection failed | Start Redis or use MemoryRouter("in_memory") |
MCP connection refused | Ensure MCP server is running and path is correct |
Token limit exceeded | Increase total_tokens_limit or enable context management |
Next Steps
Configuration
Full reference for env vars, agent settings, and models
Memory Deep Dive
5 backends with runtime switching and summarization
Agent Harness
Dynamic subagents and workspace-backed coordination for complex tasks