Skip to content

Storage and Observability

Agiwo separates storage into two independent concerns: run and step persistence, and trace collection.

LayerPurposeInterface
Run and step storagePersist agent run and step recordsRunStepStorage
Trace storageDistributed traces for observabilityBaseTraceStorage
from agiwo.agent import RunStepStorageConfig
from agiwo.agent.storage.factory import create_run_step_storage
storage = create_run_step_storage(
RunStepStorageConfig(storage_type="sqlite", config={"db_path": "runs.db"})
)
  • Run records: input, output, timestamps, token usage, status
  • Step records: LLM messages, tool calls, tool results, intermediate reasoning
  • Cost tracking: per-step and per-run token counts and estimated costs

The SDK does not expose a standalone SessionStorage abstraction. Session state is handled by the console server or by in-memory runtime state during agent execution.

from agiwo.agent import TraceStorageConfig
from agiwo.observability import create_trace_storage
trace_storage = create_trace_storage(
TraceStorageConfig(storage_type="sqlite", config={"db_path": "traces.db"})
)

Pass trace configuration through AgentOptions:

from agiwo.agent import Agent, AgentConfig, AgentOptions
agent = Agent(
AgentConfig(
name="assistant",
description="...",
system_prompt="...",
options=AgentOptions(
trace_storage=TraceStorageConfig(
storage_type="sqlite",
config={"db_path": "traces.db"},
)
),
),
model=model,
)
Trace
|- Span: Agent execution
| |- Span: LLM call
| |- Span: Tool execution
| `- Span: Tool execution
|- Span: LLM call
`- Span: Child agent
BackendUse CasePersistence
memoryTesting, ephemeral workloadsNo
sqliteSingle-node deployments, developmentYes
mongodbMulti-process deploymentsYes

When price fields are set on the model, the SDK records cost alongside token counts:

model = OpenAIModel(
id="gpt-4o",
name="gpt-4o",
input_price=0.005,
output_price=0.015,
cache_hit_price=0.001,
)