Prompt Buddy logoPrompt Buddy

openai · OpenAI Platform Docs

Running agents

Explains the core agent execution loop, including model calls, tool execution, and agent handoffs, while detailing four distinct conversation strategies for managing state across multi-turn interactions.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Running agents

Explains the core agent execution loop, including model calls, tool execution, and agent handoffs, while detailing four distinct conversation strategies for managing state across multi-turn interactions.

When To Use

Use when implementing the runtime logic for an agent, managing conversation state across multiple turns, or deciding between local and server-managed session persistence.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/running-agents-workflow-guide.mdA guide explaining the agent runtime loop, conversation strategies, incremental streaming, and handling pauses or failures when running agents.Questions about a guide explaining the agent runtime loop, conversation strategies, incremental streaming, and handling pauses or fai...
examples/running-agents-openai-agents-typescript-run-agent-memory-session.typescriptA TypeScript example demonstrating how to initialize an Agent and use a MemorySession to maintain state across multiple turns using the run function.Exact payloads, commands, or snippets shown in A TypeScript example demonstrating how to initialize an Agent and use a MemorySession to maintain state across multip...
examples/running-agents-openai-agents-python-runner-sqlite-session.pythonA Python script demonstrating how to use the OpenAI Agent Runner with a SQLite session to maintain conversation state.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the OpenAI Agent Runner with a SQLite session to maintain conversation state.
examples/running-agents-openai-agents-typescript-run-agent.typescriptA TypeScript code example demonstrating how to initialize an Agent and use the run function to execute a conversation.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to initialize an Agent and use the run function to execute a conversation.
examples/running-agents-openai-agents-python-runner-execution.pythonA Python script demonstrating how to use the Agent and Runner classes to execute multi-turn conversations with state persistence.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the Agent and Runner classes to execute multi-turn conversations with state...
examples/running-agents-openai-agents-typescript-run-agent-stream.typescriptA TypeScript example demonstrating how to initialize an Agent and run it using a streaming response loop.Exact payloads, commands, or snippets shown in A TypeScript example demonstrating how to initialize an Agent and run it using a streaming response loop.
examples/running-agents-openai-agents-python-runner-streamed.pythonA Python script demonstrating how to use the Runner.runstreamed method to execute an agent and iterate through event streams.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the Runner.runstreamed method to execute an agent and iterate through event...

What This Skill Covers

  • Defining an agent is only the setup step. The runtime questions are what a single run does, how the next turn continues, and how the workflow behaves when it...
  • Main sections: The agent loop, Choose one conversation strategy, Stream runs incrementally, Handle pauses and failures deliberately, Next steps.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.openai.com/api/docs/guides/agents/running-agents.md