Please enable JavaScript.
Coggle requires JavaScript to display documents.
OPENCLAW AGENT FLOW - Coggle Diagram
OPENCLAW AGENT FLOW
Build context
Load agent instructions
Load workspace files
Load relevant memory
Load conversation history
Add the current message and attachments
Add model and tool configuration
Apply security and sandbox rules
Inbound event
Channel or client sends a message
Gateway receives the event
Authenticate and check access
Normalize message and attachments
Routing
Read channel, account, sender, and conversation
Check agent bindings
Binding matches
Select the assigned agent
No binding matches
Select the default agent
Resolve the session
Existing session
Load history and state
New session
Create session state
Queue the run for that session
Deliver and close
Runtime returns response to Gateway
Gateway sends response to the originating channel
Update session history
Release the session queue
Tool control
Validate tool and arguments
Check tool permissions
Approval required
Request approval
Approved
Continue
Rejected or expired
Block the action
Return the outcome to the model
Approval not required
Continue under policy
Select execution environment
Host
Sandbox
Browser
Connected node
Plugin or MCP service
Tool execution
Run the selected tool
Shell or command
File operation
Browser or web search
Memory operation
Messaging or session action
Plugin or MCP action
Supported device action
Capture output or error
Return result to the model
Model decision
Send context to the configured model
Model chooses the next step
Need clarification
Send a question through the Gateway
Wait for the user's reply
Direct answer
Draft the response
Tool needed
Create a tool call
Delegation needed
Start a configured subagent
Agent loop
Add tool result to context
Ask the model what to do next
Another tool is needed
Return to Tool control
More work is delegated
Wait for subagent result
Add result to context
Task is complete
Prepare final response
Tool failed
Retry if safe
Otherwise explain the failure
Other triggers
Heartbeat, cron, or webhook starts a run
Resolve agent and session
Join Build context