Skip to content

Data Management

How data flows through AmritaCore: messages, memory, backends, and the DI contexts that carry state between workflow nodes.

Messages

TypeRole
MessageOne conversation message (role, content, tool_calls, reasoning_content)
ToolResultA tool's output, paired with its tool_call_id
SendMessageWrapThe working context: train + memory + user_query + end_messages
UniResponseNormalized LLM response (content, tool_calls, reasoning_content, usage)

SendMessageWrap is what strategies mutate — ctx.message.append(...) adds to end_messages, which unwrap() includes in the next request.

DI Contexts

Workflow nodes receive state via type-matched injection — each node declares parameters like loop: AgentLoopState and the interpreter injects the matching instance. Key contexts (all owned by ChatObject):

ContextCarries
SessionMetadatasession/stream ids, timestamps
MemoryContextruntime memory
AbilityStateconfig, preset, backend slots
GeneralInputuser input, train, template
WorkingStatethe SendMessageWrap
RespStateresponse + usage
AgentLoopStatestrategy, call count, run_state
StrategyPayloadthe strategy factory
DatabackendOptionsbackend fetch/commit skip flags

In AmritaSense terms this is the standard dependency-injection mechanism — see sense.amritabot.com for the general rules.

Two Deep-Dives

PageCovers
Data BackendThe AbilityBackend / MemoryBackend interfaces and how to write your own
Memory ModelMemoryModel, the load/commit lifecycle, and the legacy StateContext accessor

Next

Extensions & Integration — adapters, tools, MCP and tokenizers.

Apache 2.0 License