This commit is contained in:
2026-08-21 22:39:51 +07:00
parent d2592ab6d6
commit 5f284883b3
5 changed files with 15 additions and 13 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ Julia framework for building agents with tool use and MCP (Model Context Protoco
```julia
agent = YiemAgent.yiemAgent(llmCall; mcpServer=mcpServer, eventSink=yourSink)
```
4. Call `runAgent(agent, message)` then `takeResponse(agent)`
4. Call `promptAgent(agent, message)` then `takeResponse(agent)`
## Architecture
@@ -20,7 +20,7 @@ src/
├── type.jl # Core types (messages, tools, agent state)
├── utils.jl # Message formatting, context preparation, validation
├── agentCore.jl # Agent loop, tool execution pipeline
├── api.jl # Public API (runAgent, takeResponse, followUp, stopAgent)
├── api.jl # Public API (promptAgent, takeResponse, followUp, stopAgent)
└── toolRegistry.jl # Tool store, MCP discovery, listTools registration
```
@@ -114,7 +114,7 @@ Tools are discovered dynamically via MCP server:
| Function | Description |
|----------|-------------|
| `runAgent(agent, msg)` | Send a message to the agent's input channel |
| `promptAgent(agent, msg)` | Send a message to the agent's input channel |
| `takeResponse(agent)` | Block and take the agent's response from output channel |
| `followUp(agent, msg)` | Send a follow-up message while agent is still processing |
| `stopAgent(agent)` | Gracefully stop the agent and close channels |
@@ -122,7 +122,7 @@ Tools are discovered dynamically via MCP server:
## Agent Lifecycle
1. `yiemAgent()` spawns a background task (`_agentLoop`) listening on `inputChannel` and `followUpChannel`
2. User messages enter via `runAgent()` or `followUp()`
2. User messages enter via `promptAgent()` or `followUp()`
3. `_processMessage()` handles LLM calls, tool execution, and conversation history
4. Tool execution follows three phases: `prepareToolCall` → `executePreparedToolCall` → `finalizeExecutedToolCall`
5. `beforeToolCall`/`afterToolCall` hooks allow pre/post-processing of tool calls