Skip to main content

Module agent

Module agent 

Source
Expand description

Agent module - event-driven AI agent implementation.

Provides Agent struct with streaming responses, tool execution, and event output.

§Module Structure (Refactoring in Progress)

The agent module is being refactored to improve separation of concerns:

Current Structure (will be phased out):

  • builder.rs: Agent builder pattern
  • helpers.rs: Helper functions and utilities
  • run.rs: Main execution loop (716 lines, to be simplified)
  • streaming.rs: Streaming response handling
  • tools.rs: Tool execution logic
  • types.rs: Agent struct definition (26 fields, to be split)

New Structure (being introduced in phases):

  • core/: Core configuration and state management
    • config.rs: Configuration constants (max iterations, retries, etc.)
    • state.rs: State management (messages, tokens) - Phase 3
    • executor.rs: Execution engine - Phase 7
  • context/: Context management
    • manager.rs: Context manager - Phase 4
  • session/: Session management
    • manager.rs: Session manager - Phase 6
  • tests/: Comprehensive test coverage

Re-exports§

pub use core::AgentConfig;
pub use core::AgentState;
pub use context::AgentContext;
pub use session::SessionManager;

Modules§

context
Agent context management.
core
Agent core components.
session
Agent session management.

Structs§

Agent
MAX_ITERATIONS Documentation:
AgentBuilder
Agent builder
ContextInfo
Context information for display