This commit is contained in:
2026-08-11 18:57:53 +07:00
parent bad14fbe7f
commit 83c7770877
6 changed files with 30 additions and 24 deletions
+13 -13
View File
@@ -24,16 +24,16 @@ The agent processes messages from `inputChannel` in the background task.
- The same `agent` instance for chaining
# Notes
- Use `take_response(agent)` to receive the agent's response after sending a message.
- Use `follow_up(agent, msg)` to send messages while the agent is still processing.
- Use `takeResponse(agent)` to receive the agent's response after sending a message.
- Use `followUp(agent, msg)` to send messages while the agent is still processing.
# Examples
```jldoctest
julia> run_agent(agent, "Hello!")
julia> runAgent(agent, "Hello!")
yiemAgent(...)
```
"""
function run_agent(agent::yiemAgent, msg)
function runAgent(agent::yiemAgent, msg)
put!(agent.inputChannel, msg)
return agent
end
@@ -50,15 +50,15 @@ Blocks until the agent sends a response.
- An `assistantMessage` instance representing the agent's response
# Notes
- Use `run_agent(agent, msg)` to send a message before calling this function.
- Use `runAgent(agent, msg)` to send a message before calling this function.
# Examples
```jldoctest
julia> response = take_response(agent)
julia> response = takeResponse(agent)
assistantMessage(...)
```
"""
function take_response(agent::yiemAgent)
function takeResponse(agent::yiemAgent)
return take!(agent.outputChannel)
end
@@ -76,17 +76,17 @@ and before any tool call results are sent.
- The same `agent` instance for chaining
# Notes
- Use `run_agent(agent, msg)` for the primary message and `follow_up(agent, msg)` for additional
- Use `runAgent(agent, msg)` for the primary message and `followUp(agent, msg)` for additional
messages while the agent is processing.
- Follow-up messages are buffered in a separate channel (capacity 32 by default).
# Examples
```jldoctest
julia> follow_up(agent, "Also consider red wines")
julia> followUp(agent, "Also consider red wines")
yiemAgent(...)
```
"""
function follow_up(agent::yiemAgent, msg)
function followUp(agent::yiemAgent, msg)
put!(agent.followUpChannel, msg)
return agent
end
@@ -104,16 +104,16 @@ then closes all channels (`inputChannel`, `outputChannel`, `followUpChannel`).
- `nothing`
# Notes
- After calling `stop_agent`, the agent is no longer usable. A new agent must be created
- After calling `stopAgent`, the agent is no longer usable. A new agent must be created
for further interaction.
- If the background task throws a `TaskFailedException`, it is rethrown.
# Examples
```jldoctest
julia> stop_agent(agent)
julia> stopAgent(agent)
```
"""
function stop_agent(agent::yiemAgent)
function stopAgent(agent::yiemAgent)
put!(agent.inputChannel, :shutdown)
try
fetch(agent._agent_loop)