This commit is contained in:
2026-08-12 20:10:51 +07:00
parent 4e592173a6
commit 77adeb3a6b
4 changed files with 119 additions and 60 deletions
+4 -4
View File
@@ -152,7 +152,7 @@ result = getTime_tool.execute("call-1", Dict("city" => "Tokyo"), sig, op)
**Via agent loop (production):**
```
user message → runAgent(agent, Dict("role"=>"user", "content"=>...))
→ _agent_loop detects message → @spawn _process_message(agent)
→ _agentLoop detects message → @spawn _process_message(agent)
→ prepareContext → formatMsgForLLM → llmCall
→ LLM returns tool_calls
→ executeToolCalls(context, response, tool_call_list, config, signal, emit)
@@ -376,7 +376,7 @@ This ensures that `yiemAgent` instances with different `tool_store` references o
**Source:** `agentCore.jl:35-145`
The `_agent_loop()` function runs as a background `@spawn` task, created when `yiemAgent` is constructed.
The `_agentLoop()` function runs as a background `@spawn` task, created when `yiemAgent` is constructed.
### Channel Architecture
@@ -404,7 +404,7 @@ The loop tracks 6 states (documented at `agentCore.jl:39-75`):
### Loop Logic (simplified)
```julia
function _agent_loop(agent::yiemAgent)
function _agentLoop(agent::yiemAgent)
while true
# 1. Wait for message from inputChannel (blocking poll)
msg = fetch!(agent.inputChannel) # agentCore.jl:84
@@ -1332,7 +1332,7 @@ USER SENDS MESSAGE
LOOP ITERATION 1 — LLM DECIDES TO USE A TOOL
└─> _agent_loop: detects msg in inputChannel
└─> _agentLoop: detects msg in inputChannel
└─> Threads.@spawn _process_message(agent)
── _process_message ──────────────────────────────────────────────