OpenHands
cetra traces OpenHands SDK agent runs. The OpenHands SDK sends its spans through the Laminar SDK, which exports them to cetra over OTLP.
Install
Section titled “Install”pip install "openhands-sdk==1.62.0"The OpenHands SDK installs the lmnr package that exports the spans.
Set up
Section titled “Set up”The Laminar SDK reads its OTLP settings from the environment, so set them before you start the run. Use your sk-cetra-… key, and never set LMNR_PROJECT_API_KEY: with it, Laminar sends the spans to its own cloud instead of to cetra.
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:8080/v1/tracesexport OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20$CETRA_API_KEY"export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobufexport OTEL_EXPORTER=otlp_httpexport LMNR_FORCE_HTTP=trueexport LITELLM_LOCAL_MODEL_COST_MAP=Trueexport OPENHANDS_SUPPRESS_BANNER=1LITELLM_LOCAL_MODEL_COST_MAP=True makes LiteLLM use the cost map in its package instead of downloading one.
import osimport tempfile
from lmnr import Laminarfrom openhands.sdk import LLM, Agent, Conversation
llm = LLM( model="openai/gpt-4o-mini", api_key=os.environ["OPENAI_API_KEY"], usage_id="agent",)agent = Agent(llm=llm, tools=[])
with tempfile.TemporaryDirectory() as workspace: conversation = Conversation(agent=agent, workspace=workspace) conversation.send_message("What is the weather in Paris?") conversation.run()
Laminar.force_flush()tools=[] leaves only the built-in finish tool. Add your own tools with the openhands-tools package and your own tool definitions.
What you get
Section titled “What you get”A run produces these spans, which the fixture holds in the shape the SDK sends:
- a
chainspan namedconversation.runas the root, with the conversation’s ID as the session; - a
chainspan namedagent.stepfor each step of the agent; - a
chainspan namedllm.openai/gpt-4o-minithat wraps each model call and holds the cost the SDK reports; - an
llmspan namedlitellm.completionunder it, with the provideropenai, the model, the token counts, the messages and the cost computed from the built-in prices; - a
toolspan for each tool call, such asFinishAction, with the action as its input.
The wrapper span is a chain span, so the reported cost and the computed cost of the model call are not both counted.
Limits
Section titled “Limits”- This page is set up only. The OpenHands case in cetra’s fixtures was written by hand from a run of the SDK, not captured by the capture program, so the shape is checked but no live run is.
- The fixture was taken from openhands-sdk 1.62.0, with the Laminar SDK 0.8.8 and LiteLLM 1.105.7.
- The run uses the SDK’s built-in
finishtool. A call to a tool that the agent does not have is recorded as anInvalidToolCalltoolspan. - If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.
- Send OpenTelemetry: the endpoint and the key for any OTLP exporter.