OpenAI
Completions, streams, and tool calls.
Use the official openai package. Agenko does not wrap your client in an Agenko-specific class.
import openai
import agenko
agenko.init()
client = openai.OpenAI()
@agenko.check
def answer(question: str) -> str:
res = client.chat.completions.create(
model="gpt-4.1-mini",
messages=[{"role": "user", "content": question}],
)
return res.choices[0].message.content or ""What you get
Completions, streamed tokens, and tool calls become OTEL spans (OpenInference OpenAI instrumentor). @check maps tool.name / gen_ai.tool.* into claimed vs actual.
Optional: import agenko.openai for the explicit drop-in. Auto-detect is enough for most apps.
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
- Full index: docs.agenko.app/llms.txt · sections: llms-docs.txt, llms-sdk.txt, llms-integrations.txt
- This page as markdown: docs.agenko.app/openai-sdk.md
- Search API:
curl -sG "https://docs.agenko.app/api/search-docs" --data-urlencode "query=…"
Before writing SDK code
- Install the agent skill or read Agent skill
- Read Best practices — what a good receipt looks like
- Trust boundary:
@checkafter,@approvebefore init()— zero required args, never throws- Mark
estimated: trueuntil a check is a hard fact - Shipped vs backlog: Introduction status table