OpenAI
Give an OpenAI agent Pictograph's tools: function definitions for the Responses API, or ready-made tools for the openai-agents SDK, from one registry.
On this page
Using Codex? Run pictograph init for an AGENTS.md instead (Agents).
Guardrails for your own agent: Agents.
Source: agents/openai.py
OpenAI Responses API
Function definitions for responses.create, with no extra dependencies; you run the loop.
import json
from openai import OpenAI
from pictograph.agents import create_toolkit, for_openai_responses
toolkit = create_toolkit()
tools = for_openai_responses(toolkit)
client = OpenAI()
input_messages = [
{"role": "user", "content": "Show my Pictograph credit balance and recent training runs."},
]
while True:
response = client.responses.create(
model="gpt-5",
input=input_messages,
tools=tools,
)
function_calls = [o for o in response.output if o.type == "function_call"]
if not function_calls:
print(response.output_text)
break
for call in function_calls:
result = toolkit.dispatch(
name=call.name,
args=json.loads(call.arguments),
)
input_messages.append(call)
input_messages.append(
{
"type": "function_call_output",
"call_id": call.call_id,
"output": json.dumps(result, default=str),
}
)
OpenAI Agents SDK
The Agents SDK runs the loop for you. It needs the agents extra:
pip install 'pictograph[agents]'
from agents import Agent, Runner
from pictograph.agents import create_toolkit, for_openai_agents
toolkit = create_toolkit()
agent = Agent(
name="Pictograph driver",
instructions=(
"Drive Pictograph for the user. Confirm destructive operations. "
"Use the pipeline tools one at a time and check each result."
),
tools=for_openai_agents(toolkit),
)
result = Runner.run_sync(
agent,
"Upload ./road_signs, draft labels for cars and people, and stop for my review.",
)
print(result.final_output)