Skip to main content
Back to path selection

Level 03 / AI engineers

Inside the runtime that runs your agents

Open Agent Kernel (OAK) sits between your agent code and the infrastructure it runs on. This page covers how it compares with the alternatives, where it sits in a request, and the memory, hook and queue machinery you can build on.

01Compare

A runtime, without giving up the choice

Managed platforms give you a runtime and take the choice of cloud and framework. Frameworks leave you the choice and no runtime. OAK is built to give you both.

Managed cloud platforms, agent frameworks and OAK, compared on seven questions
QuestionManaged cloud platformsBedrock AgentCore, Azure AI Foundry, Vertex AIAgent frameworksLangGraph, CrewAI, OpenAI Agents and othersOAKOpen Agent Kernel
Switch cloud platform later?RewriteYou build itOne config change
Run agents from several frameworks together?Not possibleNot possibleIn one runtime
Integrations out of the box?Slack, Teams, REST, A2A, MCPPartialBuild your ownBuilt in
Sessions, memory and observability?ProprietaryBuild your ownBuilt in and pluggable
Knowledge bases?ProprietaryBuild your ownBuilt in and pluggable
Open source, with no licence fee?NoYesApache 2.0
Lift and shift an existing agent?RewriteRewriteWrap and ship

02Placement

Where OAK sits in an agent system

Three views of one system: what you set out to build, what it takes to run it, and the part OAK takes over.

Input Message
Guardrails

Multi-Agent System

Agent Memory
Supervisor Agent
General Agent
Travel Expert Agent
Booking Agent
Destination Discovery Tool
Localized Knowledge Query Tool
Flight Booking Tool
Hotel Booking Tool
Language Detection and Translation Tool
Guardrails
Output Message
A compliant multi-agent system has more parts than agents: guardrails on the way in and out, a supervisor, specialist agents, their tools and shared memory.

03Memory

Three layers of memory, one context window

Keep the conversation coherent, enrich a single request, and carry session data forward, without filling the model's context with it.

  • Session

    Conversational state

    The turns of the conversation, kept by the session store. This is what gives a chat its continuity.

  • One request

    Volatile cache

    A scratchpad for a single request: retrieved passages, file reads, intermediate results. It clears after every reply.

  • Session

    Non-volatile cache

    Supporting data that should outlive a request: user preferences, auth context, counters. Tools and hooks read it without spending model tokens.

hooks.py
from agentkernel import PreHook, Session
from agentkernel.core.memory import KeyValueCache

class MyHook(PreHook):
async def on_run(self, session: Session, agent, requests):
# Get caches from session
v_cache: KeyValueCache = session.get_volatile_cache()
nv_cache: KeyValueCache = session.get_non_volatile_cache()

# Use the caches
v_cache.set("temp_data", "value")
user_pref = nv_cache.get("user_language")

return requests

04Hooks

Hooks around every run

Control what reaches an agent and what leaves it, without touching the agent's own logic. Hooks work with every framework adapter.

  1. Request
  2. Pre-hooks
  3. Agent
  4. Post-hooks
  5. Reply
  • Before the run

    A pre-hook receives the requests and may change them: redact, validate, add retrieved context or attach files.

  • After the run

    A post-hook receives the reply, and each one sees what the hook before it returned: moderate, add a disclaimer, log for audit.

  • Stop early

    A pre-hook that returns a reply ends the run before the model is called. Use it for input guardrails, rate limits and cached answers.

my_agent.py
from agentkernel.openai import OpenAIModule
from agents import Agent

# Create your agent
agent = Agent(name="assistant", instructions="...")

# Register agent and hooks using method chaining
OpenAIModule([agent]).pre_hook(agent, [
RAGHook(),
GuardRailHook(),
]).post_hook(agent, [
ModerationHook(),
DisclaimerHook(),
])

05Scale and evidence

Scale it, then prove it works

A queue between the caller and the agent sets how the system behaves under load. Traces you can read back tell you how it behaved.

  1. Request handler
  2. Input queue
  3. Agent runner
  4. Output queue
  5. Response handler

Queue mode

  • The request path and the agent runners scale separately
  • Turns of one session stay in order, while sessions run in parallel
  • A message leaves the queue only when it is fully processed, so a crashed worker loses nothing
  • The number of consumers, not the arrival rate, sets how hard the model provider is hit
  • in_memory
  • sqs
  • kafka
  • nats
  • pubsub
  • servicebus

Traces you can read back

Spans written to Langfuse, OpenLLMetry, Pydantic Logfire or CloudWatch come back through one provider-neutral call, grouped into traces with their input, output, tool calls and usage. An evaluation job can grade real runs.

evaluate.py
from datetime import timedelta

from agentkernel.trace import SpanStatus, Trace

for trace in Trace.get().fetch_traces(session_id="session-123", last=timedelta(hours=24)):
if trace.root is None:
continue # the root span isn't stored (yet), so there is no request to grade
print(trace.trace_id, trace.user_input, trace.output, trace.usage.cost, trace.agent_names)
failed = [span.name for span in trace.tool_spans if span.status == SpanStatus.ERROR]

Ship your first agent today

Free and open source under Apache 2.0. No licensing costs and no lock-in.