Skip to main content

Module controller

Module controller 

Source
Expand description

LLM session controller and tool execution. LLM session controller and tool execution framework.

Modules§

session
Session management and context compaction. LLM session management with automatic context compaction.
stateless
Stateless execution support. Stateless LLM execution without session management.
tools
Tool execution and user interaction. Tool execution framework with built-in tools.
types
Core types for controller communication. Core types for controller communication and message handling.
usage
Token usage tracking. Token usage tracking and metrics.

Structs§

Answer
Answer to a question - simplified to just question text and answer values.
AskForPermissionsTool
Tool that requests permission from the user for sensitive actions.
AskUserQuestionsRequest
Request to ask user questions.
AskUserQuestionsResponse
Response containing answers to questions.
AskUserQuestionsTool
Tool that asks the user structured questions.
BashTool
Tool that executes bash commands with permission checks.
CompactResult
Result of a manual compaction operation. Used by force_compact() to report what happened during compaction.
CompactionConfig
Configuration for conversation compaction
ControllerInputPayload
Payload for input to the controller
DisplayConfig
Configuration for how a tool should be displayed in the UI.
DisplayResult
Formatted display result from a tool.
EditFileTool
Tool that performs find-and-replace operations on files.
FromLLMPayload
Payload for responses from the LLM
GlobTool
Tool that finds files matching glob patterns with permission checks.
Grant
A permission grant combining a target and permission level.
GrepTool
Tool that searches file contents using ripgrep with permission checks.
LLMController
The main LLM controller that manages sessions and coordinates communication
LLMSession
A session that manages communication with an LLM
LLMSessionConfig
Configuration for creating an LLM session
LLMSessionManager
Manages multiple LLM sessions
LLMTool
Tool definition for function calling.
LsTool
Tool that lists directory contents.
MultiEditTool
Tool that performs multiple find-and-replace operations atomically.
PendingPermissionInfo
Information about a pending permission request for UI display.
PendingQuestionInfo
Information about a pending interaction for UI display.
PermissionPanelResponse
Response from the UI to a permission request.
PermissionRegistry
Registry for managing permission grants and requests.
PermissionRequest
A request for permission to perform an operation.
ReadFileTool
Tool that reads files from the filesystem.
RequestOptions
Request options that can override config defaults.
SessionStatus
Current status of an LLM session
StatelessConfig
Configuration for creating a stateless executor.
StatelessExecutor
Stateless executor for single LLM requests without session state. Safe for concurrent use - multiple tasks can call execute simultaneously.
StatelessResult
Result from a stateless execution.
ToLLMPayload
Payload for requests sent to the LLM
TokenMeter
Token meter for tracking input and output tokens.
TokenUsage
Token usage statistics for the session
TokenUsageTracker
Thread-safe token usage tracker. Tracks usage by session, model, and total.
ToolBatchResult
Batch result containing all results from parallel tool executions.
ToolContext
Context provided to tools during execution.
ToolDefinition
Tool definition for the LLM.
ToolExecutor
Manages tool execution with support for parallel batch execution.
ToolRegistry
Thread-safe registry for managing available tools.
ToolRequest
Request to execute a tool.
ToolResult
Result from a single tool execution.
TurnCounter
Thread-safe counter for generating turn numbers
TurnId
Identifies a turn in the conversation (e.g., “u1”, “a1”, “u2”, “a2”)
UserInteractionRegistry
Registry for managing pending user interactions.
ValidationError
Validation error response.
ValidationErrorDetail
Detail about a single validation error.
WebSearchTool
Tool that performs web searches using Claude’s built-in capability.
WriteFileTool
Tool that writes files to the filesystem with permission checks.

Enums§

ContentBlock
A content block within a message
ControlCmd
Control commands for the controller
ControllerError
Error type for controller operations.
ControllerEvent
Event emitted by the controller
GrantTarget
The target of a permission grant.
GrepOutputMode
Output mode for grep results.
InputType
Type of input to the controller
LLMProvider
LLM provider type
LLMRequestType
Type of request being sent to the LLM
LLMResponseType
Type of response from the LLM
Message
A message in the conversation
MessageRole
Role of a message in the conversation
PermissionError
Error types for permission operations.
PermissionLevel
Permission level that determines what operations are allowed.
Question
Question types supported by the tool.
ResultContentType
Content type for formatting tool results.
StatelessError
Errors that can occur during stateless execution.
ToolCompaction
Defines how tool results are handled during compaction.
ToolResultStatus
Result status from tool execution.
ToolType
Tool type classification.
UserInteractionError
Error types for user interaction operations.
ValidationErrorCode
Error codes for validation failures.

Constants§

ASK_FOR_PERMISSIONS_TOOL_DESCRIPTION
AskForPermissions tool description constant.
ASK_FOR_PERMISSIONS_TOOL_NAME
AskForPermissions tool name constant.
ASK_FOR_PERMISSIONS_TOOL_SCHEMA
AskForPermissions tool JSON schema constant.
ASK_USER_QUESTIONS_TOOL_DESCRIPTION
AskUserQuestions tool description constant.
ASK_USER_QUESTIONS_TOOL_NAME
AskUserQuestions tool name constant.
ASK_USER_QUESTIONS_TOOL_SCHEMA
AskUserQuestions tool JSON schema constant.
BASH_TOOL_DESCRIPTION
Bash tool description constant.
BASH_TOOL_NAME
Bash tool name constant.
BASH_TOOL_SCHEMA
Bash tool JSON schema constant.
DEFAULT_CHANNEL_SIZE
Default channel buffer size for internal communication. This applies to all async channels: LLM responses, tool results, UI events, etc. Can be overridden via AgentConfig::channel_buffer_size().
EDIT_FILE_TOOL_DESCRIPTION
EditFile tool description constant.
EDIT_FILE_TOOL_NAME
EditFile tool name constant.
EDIT_FILE_TOOL_SCHEMA
EditFile tool JSON schema constant.
GLOB_TOOL_DESCRIPTION
Glob tool description constant.
GLOB_TOOL_NAME
Glob tool name constant.
GLOB_TOOL_SCHEMA
Glob tool JSON schema constant.
GREP_TOOL_DESCRIPTION
Grep tool description constant.
GREP_TOOL_NAME
Grep tool name constant.
GREP_TOOL_SCHEMA
Grep tool JSON schema constant.
LS_TOOL_DESCRIPTION
Ls tool description constant.
LS_TOOL_NAME
Ls tool name constant.
LS_TOOL_SCHEMA
Ls tool JSON schema constant.
MULTI_EDIT_TOOL_DESCRIPTION
MultiEdit tool description constant.
MULTI_EDIT_TOOL_NAME
MultiEdit tool name constant.
MULTI_EDIT_TOOL_SCHEMA
MultiEdit tool JSON schema constant.
READ_FILE_TOOL_DESCRIPTION
ReadFile tool description constant.
READ_FILE_TOOL_NAME
ReadFile tool name constant.
READ_FILE_TOOL_SCHEMA
ReadFile tool JSON schema constant.
WEB_SEARCH_TOOL_DESCRIPTION
Web Search tool description constant.
WEB_SEARCH_TOOL_NAME
Web Search tool name constant.
WEB_SEARCH_TOOL_SCHEMA
Web Search tool JSON schema constant.
WRITE_FILE_TOOL_DESCRIPTION
WriteFile tool description constant.
WRITE_FILE_TOOL_NAME
WriteFile tool name constant.
WRITE_FILE_TOOL_SCHEMA
WriteFile tool JSON schema constant.

Traits§

Executable
Trait for executable tools.