Explore ACDL specifications for common agentic patterns and real-world systems
Foundational structures for LLM context management
The simplest ACDL specification: a system message with instructions
Context[@T]: { S: PERSONA S: INSTRUCTIONS }
Retrieval-augmented generation with document context
BasicRAG[@T]: { S: INSTRUCTIONS U: { Name docs := k_relevant_docs(env.user_input[@T]) ForEach(i: range(1, $docs.len)) { $docs[i].source $docs[i].content } ANSWER_Q_FROM_DOCS env.user_input[@T] } }
Reasoning and action loops for tool-using agents
Basic ReAct loop with tool reasoning and responses
ReactBase[@T]: { S: { INSTRUCTIONS AVAILABLE_TOOLS } U: env.user_input[@1] // history ForEach(@t: range(1, @T-1)) { A: { resp.tool_reasoning[@t] sys.tool_used[@t] } T: sys.tool_used[@t].tool_response } S: USE_TOOLS_TO_SOLVE_TASK }
Variant without reasoning traces in action history
ReactNoReasoningInHistory[@T]: { S: { INSTRUCTIONS AVAILABLE_TOOLS } U: env.user_input[@1] // history ForEach(@t: range(1, @T-1)) { A: sys.tool_used[@t] T: sys.tool_used[@t].tool_response } S: USE_TOOLS_TO_SOLVE_TASK }
ReAct pattern with dynamic tool retrieval
ReactToolRag[@T]: { S: INSTRUCTIONS U: env.user_input[@1] ForEach(@t: range(1, @T-1)) { A: { resp.tool_reasoning[@t] sys.tool_used[@t] } T: sys.tool_used[@t].tool_response } S: { Name tools := retrieve_tools(env.context[@T]) ForEach(tool: $tools) { $tool.description } USE_TOOLS_TO_SOLVE_TASK } }
Production-grade agent architectures
Coding assistant with conversation compaction, plan mode, and tool use
OpenCodeMain[@T.I]: { S: { SYSTEM_PROMPT ENV_INFO(env.working_directory[@1], ...) } Mark 2 { Name C := sys.last_compaction_time[@T] If @$C > 1 { U: WHAT_DID_WE_DO A: sys.conversation_summary[@$C] } } ForEach(@t: range(@$C, @T)) { U: { env.user_input[@t] Mark 3 { If @T == @t { If sys.is_plan_mode[@t] { PLAN_MODE_REMINDER } If sys.is_build_mode[@t] && sys.prev_is_plan[@t] { LEAVE_PLAN_MODE_REMINDER } } } } PromptEndsHere when (@T == @t && @T.0) ForEach(@i: range(1, @t.substeps)) { Mark 1 { A: { ForEach(tool: sys.tool_requests[@t.i]) { tool.id_name_and_args } } ForEach(tool: tool_requests[@t.i]) { T: tool.id_and_response } } PromptEndsHere when (@T == @t && @T.I) } A: sys.response[@t] } }
Persistent agent with heartbeat timer, pending messages, and memory
OpenClaw[@T.I]: { S: SystemPrompt() Mark 2 { Name C := sys.last_compaction_time[@T] If (@$C > 1) { U: { THIS_IS_A_SUMMARY sys.conversation_summary[@$C] } A: resp.response[@$C] } } ForEach(t: range(@$C + 1, @T)) { U: { Mark 6 { ForEach(m: range(1, sys.pending_messages[@t].len)) { sys.pending_messages[@t][m].date_time sys.pending_messages[@t][m].message } } Mark 5 { Switch env.input_source[@t] { Case user: { Mark 4 { sys.date_time[@t] } env.user_query[@t] } Case heartbeat_timer: { HEARTBEAT_INSTRUCTIONS } } } } PromptEndsHere when (@t == @T && T.0) ForEach(i: range(1, @t.substeps)) { Mark 1 { A: { ForEach(tool: sys.tool_requests[@t.i]) { tool.id_name_and_arg } } ForEach(tool: sys.tool_requests[@t.i]) { T: tool.id_and_response } } PromptEndsHere when (@t == @T && @T.I) } A: resp.response[@t] } }
Game-playing agent with hierarchical summarization and critique
Pokemon[@T]: { U: env.image.HUD // heads up display screenshot S: { INTRO GOAL CONVENTIONS AVAILABLE_TOOLS } A: { If @T>1 { ForEach(i: range(@T-(@T%100),@T-1)) { resp.action[@i] } If @T%100==0 { Name actions := [resp.action[@t] for t in range(@T-100, @T)] summarize($actions) } } } If @T%25==0 { A: critique_performance(sys.history[@T]) } U: env.xml_map[@T] S: INSTRUCTION_TO_EXPLORE S: CHOOSE_ACTION }
Agent with memory, peer awareness, and conversation handling
// agent is self, agent2 is who we converse with MultiAgent[@T, agent]: { S: INSTRUCTIONS U: { // history (last 50 actions) ForEach(@t: range(@T-50, @T-1)) { sys[agent].performed_action[@t] sys[agent].performed_action[@t].result } sys[agent].inventory[@T] // whom I see and what I know ForEach(a: env.seen_actors[@T]) { a.name a.description retrieve(sys[agent].memory[@T], a.name) } If sys[agent].in_conversation[@T] { ForEach(convTurn: sys[agent].conversation[@T]) { convTurn.speaker convTurn.content } } } S: { sys[agent].available_actions If sys[agent].in_conversation[@T] { CONTINUE_THE_CONVERSATION } } }
More examples available in the GitHub repository