State-Based Architecture
A context graph is a structured topological field of interconnected states that guide agent behavior and decision-making. Context graphs implement a hierarchical state machine (HSM) architecture, where states are organized in a structured hierarchy that enables efficient organization of complex problem spaces.
State Types
Each state type serves a specific purpose in managing conversation flow and agent behavior.
Context Graphs orchestrate agent behavior through a structured hierarchy of states:
Decision States: Choose optimal actions based on real-time data and objectives, drawing on the integrated Memory-Knowledge-Reasoning (M-K-R) system.
Action States: Execute defined tasks with clear rules and constraints, powered by the current M-K-R context.
Reflection States: Allow introspection and strategic reasoning. These are critical junctures in the M-K-R cycle, where the agent might re-evaluate its understanding (Knowledge), recontextualize Memory, and refine its Reasoning pathways before proceeding.
Recall States: Allow explicit integration with user memory to increase personalization. These states directly tap into the Memory component of M-K-R, bringing historical context to bear on current Knowledge application and Reasoning.
Annotation States: Clarify and segment complex interactions.
Side-Effect States: Touch points for external system interaction, enabling actions.
Action State Implementation Example
Each type of state has its own unique set of structured parameters and implementation best practices. For example, see below for a more detailed summary of the Action State.
Required Parameters
type
: Must be "action"objective
: Clear statement of the state's goalactions
: Ordered list of client-facing interaction stepsintra_state_navigation_guidelines
: Rules for action sequencing and exit condition selectionaction_guidelines
: Behavioral rules for the agentboundary_constraints
: Limitations on agent behaviorexit_conditions
: List of conditions that trigger state transitions
Optional Parameters
included_contexts
: Additional context informationmessage_metadata
: Metadata about messages in this state
Example
Reasoning States and Abstract Topology
Reasoning states (which include Decision and Reflection states) play a critical role in the traversal of context graphs, acting as key nodes in the integrated Memory-Knowledge-Reasoning (M-K-R) process. They impact traversal by providing both a local and global view of the problem space via an abstract topology. This abstract topological view:
Prevents Loops: Avoids repetitive cycles of states that don't make progress toward goals
Prevents Bad Traversals: Eliminates paths that don't properly consider the more global problem space view
Optimizes Transitions: Prevents both premature and late transitions to adjacent problem spaces even without perfect exit conditions
The abstract topology effectively provides a "map" of the entire problem space, allowing the agent to make informed decisions about where to go next based on both immediate context and the overall structure of the problem. This is similar to how a human expert would consider both the current details of a situation and their broader understanding of the entire domain when making decisions.
Here's a simplified example of an abstract topology for a medical check-in flow:
This abstract topology provides a concise map of the problem space, showing key states and transitions. With this global view, the agent can make informed decisions about state traversal, ensuring that the conversation follows a coherent and purposeful path while avoiding problematic patterns like loops or premature transitions.
Implementation Considerations
Context Density Calibration:
High-density example: "Verify all required regulatory compliance elements while maintaining strict protocol adherence"
Medium-density example: "Engage the client on their current query while handling natural topic changes within conversation flow"
Low-density example: "Create space for open exploration of possibilities without excessive structure"
Action Sequencing:
Define action sequences that create natural progressive movement
Balance between prescriptive steps and open exploration
Example from healthcare implementation: "Address user queries → Ask personalized follow-up questions → Handle topic changes → Track conversation context"
Navigation Guidelines Implementation:
Define intra-state movement behaviors
Example: "When client introduces a new topic, handle it within this state rather than triggering a state change"
Implementation shows how agent navigates within a single region of the field
Exit Condition Design:
Create clear, detectable boundaries for state transitions
Support both simple state transitions and cross-graph navigation
Include safety exits for unexpected situations
Last updated
Was this helpful?