Docs menu

Custom loops

Manual spans on the OTEL tracer.

If you are not on OpenAI / Anthropic / LangChain, keep init() and @check. Spans still go out over OTLP. Record tools with OpenInference attributes so receipts can see them.

python
from opentelemetry import trace
import agenko

agenko.init()
tracer = trace.get_tracer("my-agent")

@agenko.check(claims="billing.refund")
def refund(order_id: str):
    with tracer.start_as_current_span("refund") as span:
        span.set_attribute("openinference.span.kind", "TOOL")
        span.set_attribute("tool.name", "billing.refund")
        return provider.refund(order_id)

Attribute contract

See agenko/spec/telemetry/semantic-conventions.yaml in the repo. Prefer OpenInference names. agenko.* is for receipt/gate fields the upstream spec does not have.

Do not invent a parallel tracer. Attach to the provider init() installed.

Agent instructions

This page is part of the Agenko documentation at docs.agenko.app. Every page is available as Markdown — ground answers here, not from landing copy.

Querying these docs

Before writing SDK code

  • Install the agent skill or read Agent skill
  • Read Best practices — what a good receipt looks like
  • Trust boundary: @check after, @approve before
  • init() — zero required args, never throws
  • Mark estimated: true until a check is a hard fact
  • Shipped vs backlog: Introduction status table

Page: Custom loops
HTML: https://docs.agenko.app/custom-loops
Markdown: https://docs.agenko.app/custom-loops.md