Documentation Index
Fetch the complete documentation index at: https://docs.podflare.ai/llms.txt
Use this file to discover all available pages before exploring further.
Install
pip install podflare openai-agents
Use
from agents import Agent, Runner
from podflare.integrations.openai_agents import podflare_code_interpreter
tool = podflare_code_interpreter()
agent = Agent(
name="assistant",
instructions="Use the run_code tool to answer computational questions.",
tools=[tool],
)
result = await Runner.run(agent, "What is the sum of squares from 1 to 100?")
print(result.final_output)
# Cleanup the lazily-created Podflare sandbox
tool.close_podflare_sandbox()
- On the first call, lazily creates a Podflare sandbox.
- On each invocation, calls
sandbox.run_code(code, language).
- Returns a dict with keys
stdout, stderr, exit_code.
- The same sandbox is reused across invocations — Python REPL state
persists, so the agent can build up state over a conversation.
Options
tool = podflare_code_interpreter(
host="https://api.podflare.ai", # default: PODFLARE_HOSTD_URL env
template="python-datasci", # default: the primary pool
)
Cleanup
The returned tool exposes a close_podflare_sandbox() method. Call it
after the agent run completes to destroy the VM.
For many short-lived agent runs, creating a new sandbox per run is fine
(pool hits are ~10 ms). For long-running conversations, reuse the same
tool across turns to keep REPL state alive.