Skip to content

Core Concepts

From Prompts to Autonomous AI Systems

The Evolution of AI Interaction

Traditional LLM interactions rely on simple prompt-response patterns, where each interaction is stateless and isolated. YosrAI transforms this paradigm by introducing:

  1. Stateful Conversations: Maintaining context and memory across interactions
  2. Structured Behavior: Defining clear roles, goals, and constraints
  3. Action Capabilities: Enabling agents to interact with their environment
  4. Multi-Agent Coordination: Facilitating complex interactions between multiple agents

The Agentic System Hierarchy

graph TD
    A[Basic Prompt] --> B[Structured Prompt]
    B --> C[Agent with Memory]
    C --> D[Tool-Using Agent]
    D --> E[Multi-Agent System]
    style A fill:#f5f5f55e
    style B fill:#e1f5fe5e
    style C fill:#b3e5fc5e
    style D fill:#81d4fa5e
    style E fill:#4fc3f75e
  1. Basic Prompt: Simple input-output interactions
  2. Structured Prompt: Enhanced with role, context, and constraints
  3. Agent with Memory: Maintains conversation history and context
  4. Tool-Using Agent: Can perform actions and use external tools
  5. Multi-Agent System: Multiple agents collaborating towards goals

YosrAI Architecture

High-Level Design

graph TB
    A[Application] --> B[Action/Pipeline]
    B --> C[Tools/Functions]
    B --> D[Agent/Prompt]
    B --> E[Context/Memory]
    C --> F[Chat Manager]
    D --> F[Chat Manager]
    E --> F[Chat Manager]
    F --> G[LLM Provider]

    style A fill:#e1f5fe5e
    style B fill:#b3e5fc5e
    style C fill:#81d4fa5e
    style E fill:#81d4fa5e
    style G fill:#81d4fa5e
    style D fill:#4fc3f75e
    style F fill:#4fc3f75e

Core Components

1. Action/Pipeline Manager

  • Orchestrates the overall workflow and execution pipeline
  • Coordinates between tools, agents, and context
  • Manages action execution and validation
  • Handles pipeline state and flow control
  • Routes requests to appropriate components

2. Tools/Functions

  • Provides concrete actions and capabilities
  • Implements specific functionalities
  • Handles external integrations
  • Executes real-world tasks
  • Maintains action history

3. Agent/Prompt

  • Defines agent behaviors and roles
  • Manages prompt templates and structures
  • Handles agent state and lifecycle
  • Coordinates multi-agent interactions
  • Implements agent-specific logic

4. Context/Memory

  • Manages conversation and system state
  • Handles short-term and long-term memory
  • Provides context window management
  • Implements forgetting strategies
  • Maintains historical information

5. Chat Manager

  • Central communication hub
  • Coordinates between components
  • Processes messages and responses
  • Manages conversation flow
  • Integrates component outputs

6. LLM Provider

  • Abstracts LLM interactions
  • Supports multiple providers
  • Handles rate limiting and retries
  • Manages model configurations
  • Processes prompt-completion cycles

Component Relationships

Data Flow

sequenceDiagram
    participant App as Application
    participant Action as Action/Pipeline
    participant Tools as Tools/Functions
    participant Agent as Agent/Prompt #FFB74D
    participant Context as Context/Memory
    participant Chat as Chat Manager
    participant LLM as LLM Provider

    App->>Action: Request
    Action->>Tools: Get Available Tools
    Action->>Agent: Get Agent Configuration
    Action->>Context: Get Current State
    par Tools to Chat
        Tools->>Chat: Tool Definitions
    and Agent to Chat
        Agent->>Chat: Prompt Template
    and Context to Chat
        Context->>Chat: Context Window
    end
    Chat->>LLM: Generate Response
    LLM-->>Chat: LLM Response
    Chat-->>Agent: Proposed Response
    Agent->>Tools: Execute Tools
    Tools-->>Agent: Tool Results
    Agent->>Context: Update State
    Agent->>Action: Agent Response
    Action-->>App: Final Result

Key Interactions

  1. Action Pipeline Flow
  2. Orchestrates the overall interaction flow
  3. Coordinates between tools, agents, and context
  4. Manages state transitions and action execution
  5. Routes responses and updates to appropriate components

  6. Component Integration

  7. Tools provide concrete action capabilities
  8. Agent/Prompt defines behavior and structure
  9. Context/Memory maintains system state
  10. Chat Manager facilitates communication
  11. LLM Provider generates responses

  12. State Management

  13. Context maintains system-wide state
  14. Tools track action history
  15. Agent maintains prompt templates
  16. Pipeline manages workflow state
  17. Chat coordinates message flow

Best Practices

  1. Agent Design
  2. Clear role and goal definition
  3. Appropriate memory configuration
  4. Well-defined action boundaries

  5. System Architecture

  6. Modular component design
  7. Clear separation of concerns
  8. Scalable interaction patterns

  9. Implementation Strategy

  10. Start simple and increment complexity
  11. Test agent behaviors thoroughly
  12. Monitor and optimize performance

Practical Considerations

  1. Scalability
  2. Managing multiple agents
  3. Handling complex interactions
  4. Resource optimization

  5. Security

  6. Action permissions
  7. Data privacy
  8. System boundaries

  9. Maintenance

  10. Monitoring agent behavior
  11. Updating system components
  12. Managing dependencies