Skip to main content
Path A swaps the agent’s LLM client for a TELOS transport with an identical duck interface. A transport instance equals one session and internally holds a BridgeSessionState.

Anthropic client

For Claude Code / OpenClaw / Hermes / self-built Anthropic-shaped agents. Replace anthropic.Anthropic() with TelosAnthropicTransport; all other .messages.create() calls stay the same:
# before
import anthropic
client = anthropic.Anthropic()

# after
from telos.scripts.telos_anthropic_transport import TelosAnthropicTransport
client = TelosAnthropicTransport(
    session_id="my-agent-session",       # use the same id for the same conversation
    usage_log="logs/usage.jsonl",
    prompt_trace_log="logs/trace.jsonl",
    # harness_name="hermes",             # leave unset for auto-detect
)

# the call is completely unchanged
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=8192,
    system=[{"type": "text", "text": "You are an engineer."}],
    tools=[...],
    messages=[...],
)
print(response.content[0].text)

Constructor parameters

ParameterDefaultDescription
api_key$ANTHROPIC_API_KEYAnthropic API key
base_urlNone (SDK default)can point at a local proxy for debugging
session_id"telos-session"keep the same id for the same conversation; the key for multi-turn cache accumulation
harness_nameNone (auto-detect)force "openclaw" / "hermes"
engine_name"anthropic"usually left alone
usage_logNonejsonl path; one line appended per call (normalized usage)
prompt_trace_logNonejsonl path; records IR layout / plan / accumulation diagnostics
session_stateNone (new’d internally)pass explicitly when multiple transports share one conversation
Harness auto-detection: a system containing <system-reminder> / <command-message>, or a message with a thinking block → picks hermes; otherwise openclaw. See Harness integration for the full order.

OpenAI client

For telos / mini_swe_runner / self-built OpenAI-shaped agents:
# before
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1")

# after
from telos.scripts.telos_transport import TelosOpenAITransport
client = TelosOpenAITransport(
    base_url="https://openrouter.ai/api/v1",
    session_id="telos-session",
    usage_log="logs/usage.jsonl",
    engine_name="deepseek",              # or "openai"
    harness_name="telos",                # fixed
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[...],
    tools=[...],
)
The OpenAI transport goes through the telos harness and uses a custom _ir_to_chat_completions to produce the wire — preserving OpenAI’s tool_calls / role=tool structure rather than inlining it into text.

Sharing one conversation across transports

If a conversation is handled by multiple transport instances (for example, the client is rebuilt after a retry), pass BridgeSessionState in explicitly so the second instance sees the accumulated ref-pool and counters:
from telos.bridge import BridgeSessionState
from telos.scripts.telos_anthropic_transport import TelosAnthropicTransport

shared = BridgeSessionState()
t1 = TelosAnthropicTransport(session_id="conv-1", session_state=shared)
# ... t1 errors and is destroyed ...
t2 = TelosAnthropicTransport(session_id="conv-1", session_state=shared)
# t2 can see the ref-pool and R8 counts accumulated by t1

Multi-turn state accumulation

How cross-turn state is held and observed, on both paths.