Skip to main content

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 with agent.run(). It returns a dictionary with the agent’s response and metadata.

Session Management

Use session_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 a MemoryRouter to persist across restarts.
You can switch backends at runtime without restarting:

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 with ToolRegistry when the tool is specific to your application.

Event Streaming

Read telemetry events for UIs, logging, and debugging. Use run_id when multiple runs can share the same session_id.

Error Handling

Wrap agent calls with try/except for production use:

Common Troubleshooting


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