This commit is contained in:
2026-08-04 12:13:22 +07:00
parent 569f85333f
commit 937d52053f
3 changed files with 46 additions and 45 deletions
+10 -10
View File
@@ -15,7 +15,7 @@ using ..type, ..util, ..llmfunction
Send a message to the agent's input channel.
Blocks if the input channel buffer is full (capacity 16 by default).
The agent processes messages from `input_ch` in the background task.
The agent processes messages from `inputChannel` in the background task.
# Arguments
- `agent::yiemAgent`: The agent instance to send a message to
@@ -35,7 +35,7 @@ yiemAgent(...)
```
"""
function run_agent(agent::yiemAgent, msg)
put!(agent.input_ch, msg)
put!(agent.inputChannel, msg)
return agent
end
@@ -60,13 +60,13 @@ assistantMessage(...)
```
"""
function take_response(agent::yiemAgent)
return take!(agent.output_ch)
return take!(agent.outputChannel)
end
"""
Send a follow-up message while the agent is still processing.
Follow-up messages are queued and processed after all `input_ch` messages
Follow-up messages are queued and processed after all `inputChannel` messages
and before any tool call results are sent.
# Arguments
@@ -88,7 +88,7 @@ yiemAgent(...)
```
"""
function follow_up(agent::yiemAgent, msg)
put!(agent.followUpQueue, msg)
put!(agent.followUpChannel, msg)
return agent
end
@@ -96,7 +96,7 @@ end
Gracefully stop the agent.
Sends a `:shutdown` signal to the input channel, waits for the background task to finish,
then closes all channels (`input_ch`, `output_ch`, `followUpQueue`).
then closes all channels (`inputChannel`, `outputChannel`, `followUpChannel`).
# Arguments
- `agent::yiemAgent`: The agent instance to stop
@@ -115,7 +115,7 @@ julia> stop_agent(agent)
```
"""
function stop_agent(agent::yiemAgent)
put!(agent.input_ch, :shutdown)
put!(agent.inputChannel, :shutdown)
try
fetch(agent._task)
catch e
@@ -123,9 +123,9 @@ function stop_agent(agent::yiemAgent)
rethrow(e)
end
end
close(agent.input_ch)
close(agent.output_ch)
close(agent.followUpQueue)
close(agent.inputChannel)
close(agent.outputChannel)
close(agent.followUpChannel)
return nothing
end