Documentation Index
Fetch the complete documentation index at: https://docs-omnicoreagent.omnirexfloralabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Background Agents
Background agents run tracked OmniCoreAgent tasks outside the foreground request path. Use the default in-memory store for local development, or choosesql,
redis, or mongodb when tasks, runs, attempts, leases, retries, and
cancellation state must survive process restarts. A task can run manually, once
at a fixed time, on an interval, or from a five-field cron expression. Each run
is tracked through queued, claimed, running, retrying, and terminal states.
Background execution is part of the core package:
BackgroundAgentManager() uses an
in-memory task store by default so the first run has no database requirement.
Use task_store="sql", task_store="redis", or task_store="mongodb" when
tasks, runs, attempts, leases, retries, and cancellation state must survive
process restarts.
The task store is separate from agent memory. MemoryRouter stores
conversation/session history. The task store stores operational background
state and owns the atomic claim, lease, retry, and schedule-cursor guarantees.
Quick Start
SetLLM_API_KEY first, then run the example; no task-store configuration is
required.
Scheduled Runs
Start the manager when you want it to dispatch due schedules:Runtime Controls
Run Event Replay
Each run emits ordered lifecycle events with a run-localsequence number.
get_run_events(run_id) returns the most complete trace it can read from:
- the current process cache
- the run workspace
events.jsonlmirror, when workspace event mirroring is enabled
1.
Run-scoped lifecycle events include schedule dispatch, queueing, claiming,
start, heartbeat, retry, terminal status, and recovery transitions when those
transitions occur.
Durable restart replay needs workspace event mirroring enabled. If a process
exits with only in-memory events and no workspace mirror, the task store still
preserves run status, attempts, leases, and results, but old event history may
not be replayable.
OmniServe API
When an agent is served through OmniServe, the server registers that agent with the background manager during startup and exposes task control over HTTP:{"wait": true} when the HTTP request should wait for terminal run state.
If the OmniServe worker is running, the API waits for that worker-owned run. If
the worker is disabled, the API queues the run through the background manager
and drives that run inline through the same execution contract. If the run does
not finish before the background wait budget, OmniServe returns 504 and the
run remains inspectable through the background run endpoints. The wait budget is
derived from the configured request timeout and leaves a small margin for
OmniServe to return the structured response before the outer HTTP timeout. The
504 response includes the run_id, task_id, latest status,
wait_timeout_seconds, and request_timeout_seconds in detail.
The background API includes manager status, task creation, task status, task
listing, pause, resume, delete, manual run, cancellation, run status, attempt
history, event replay, and workspace inspection.
Task Configuration
| Field | Purpose |
|---|---|
task_id | Stable task identifier. |
agent_id | Registered agent that executes the task. |
query | Instruction passed to the agent for each run. |
schedule | manual, interval, cron, or once. |
timeout_seconds | Optional per-run timeout. |
retry_policy | Retry count, delay, backoff, and retryable error types. |
overlap_policy | skip_if_running, queue_next, cancel_previous, or allow_parallel. |
session_policy | task, run, or fixed memory-session behavior. |
workspace_policy | Workspace namespace used for run output. |
Persistent State
The task store is the source of truth for:- registered agent specs
- task definitions
- schedule state and occurrence IDs
- runs and attempts
- leases, heartbeats, and cancellation flags
events.jsonl mirror.
Durable stores are tested at the manager boundary. A queued run can be created,
the manager can shut down, and a new manager over the same SQL, Redis, or
MongoDB task store can claim and complete that run. The in-memory store is only
for local development, tests, and single-process experiments.
Choose one durable backend per deployment. Use SQL/SQLite for local durability
or simple single-node services. Use Redis when your deployment already operates
Redis with persistence and no eviction for task-store keys. Use MongoDB when
MongoDB is your durable operational store.
Redis durable deployments need persistence enabled and a no-eviction policy for
task-store keys. MongoDB task-store writes use majority write concern.