Skip to main content
Version: Next

Execution Flow

How requests flow through Agent Kernel from user input to agent response.

Request Lifecycle

Detailed Flow

1. Request Reception

The request enters through one of the execution modes:

  • CLI: Interactive terminal input
  • REST API: HTTP POST to /api/v1/chat endpoint
  • AWS Lambda: Lambda event
  • WebSocket: WebSocket message via WebSocket API Gateway
  • MCP/A2A: Protocol-specific request

2. Agent Resolution

runtime = Runtime.get()
agent = runtime.get_agent(agent_name)

3. Session Management

session = runtime.get_session(session_id)
# Loads existing session or creates new one

4. Agent Execution

result = await agent.runner.run(agent, session, prompt)

5. Response Return

Result is formatted and returned to the user through the appropriate channel.

Timing Diagram

Ready to Ship Your
First Agent?

Free, open-source, Apache 2.0. No licensing costs, no vendor lock-in. Join hundreds of developers building production AI agents with Agent Kernel.

Agent Kernel
Ask AI