This commit is contained in:
2026-08-03 18:03:51 +07:00
parent 92eee07168
commit 569f85333f
7 changed files with 806 additions and 324 deletions
+38 -10
View File
@@ -194,6 +194,21 @@ end
# Tool types
# ============================================================================
"""
A tool available to the agent.
# Arguments
- `name::String`: Tool identifier
- `label::String`: Human-readable tool name
- `description::String`: What the tool does
- `parameters::TParameters`: Tool parameters schema (JSON schema)
- `execute::Function`: Tool execution function
- `prepareArguments::Union{Function, Nothing}`: Optional argument preparation callback
- `executionMode::Union{toolExecutionMode, Nothing}`: Override: run tool calls sequentially or in parallel
# Returns
- A new `agentTool` instance
"""
struct agentTool{TParameters, TDetails} # A tool available to the agent
name::String # Tool identifier
label::String # Human-readable tool name
@@ -209,6 +224,17 @@ end
# Agent context
# ============================================================================
"""
Snapshot of the agent's conversation context.
# Arguments
- `systemPrompt::String`: System prompt for the agent
- `messages::Vector{agentMessage}`: Conversation messages
- `tools::Union{Vector{agentTool}, Nothing}`: Available tools
# Returns
- A new `agentContext` instance
"""
struct agentContext # Snapshot of the agent's conversation context
systemPrompt::String # System prompt for the agent
messages::Vector{agentMessage} # Conversation messages
@@ -266,9 +292,6 @@ function agentState(
)
end
# ============================================================================
# Tool call types
# ============================================================================
struct toolCall # A tool invocation from the LLM
type::String # Always "function"
@@ -278,20 +301,25 @@ struct toolCall # A tool invocation from the LLM
end
# ============================================================================
# Next turn context
# ============================================================================
"""
Context for preparing the next conversation turn.
struct nextTurnContext # Context for preparing the next conversation turn
# Arguments
- `message::assistantMessage`: The assistant's message that just completed
- `toolResults::Vector{toolResultMessage}`: Tool results from this turn
- `context::agentContext`: Current conversation context
- `newMessages::Vector{agentMessage}`: Messages to append to the context
# Returns
- A new `prepareNextTurnContext` instance
"""
struct prepareNextTurnContext # Context for preparing the next conversation turn
message::assistantMessage # The assistant's message that just completed
toolResults::Vector{toolResultMessage} # Tool results from this turn
context::agentContext # Current conversation context
newMessages::Vector{agentMessage} # Messages to append to the context
end
# ============================================================================
# llmModel types
# ============================================================================
struct modelCost # Model pricing per 1M tokens
input::Float64 # Price per 1M input tokens