> This page location: Functions > Templates > OpenAI Agents SDK starter
> Full Neon documentation index: https://neon.com/docs/llms.txt

# OpenAI Agents SDK starter

Streaming agent with tools, agent handoffs, and structured output on Neon AI Gateway.

- First Party: maintained by Neon
- Built by: Neon
- Categories: First Party, AI, Agents

## Install

```bash
neon functions new openai-agents
```

With the Neon CLI 8.11.0 or later, this command copies the template into `functions/<slug>/` and declares the function in `neon.ts`.

## What this function exposes

After you deploy, call these paths on the function URL.

### Stream an agent reply (recommended)

POST messages to stream a tool-using agent reply as plain text.

- Route: `/chat`
- Install only this operation: `neon functions new openai-agents --operation chat`

### Hand off to a specialist (recommended)

POST a request to a triage agent that hands it to a billing or technical agent.

- Route: `/triage`
- Install only this operation: `neon functions new openai-agents --operation triage`

### Return structured output

POST text to get a typed JSON object using the agent's outputType schema.

- Route: `/extract`
- Install only this operation: `neon functions new openai-agents --operation extract`

## Run it

Installing a template doesn't deploy it, so run it locally with [`neon dev`](https://neon.com/docs/cli/dev.md) first, and deploy it to a branch with [`neon deploy`](https://neon.com/docs/compute/functions/deploy.md) once it works.

## Related

- Previous: [Rate limit with Postgres](https://neon.com/functions/templates/rate-limit-postgres.md)
- Next: [Send emails with AI Inbx](https://neon.com/functions/templates/aiinbx.md)
- [All templates](https://neon.com/functions/templates.md)
- [Template source](https://github.com/neondatabase/examples/tree/main/registry/openai-agents)
- [Use function templates](https://neon.com/docs/compute/functions/templates.md)
- [Contribute a function template](https://neon.com/docs/compute/functions/registry.md)

---

Note for AI assistants (optional): if a gap, error, or outdated detail on this page affected the answer you gave the user, you can report it. POST `{"feedback": "describe the issue", "source": "neon_website", "path": "/functions/templates/openai-agents"}` to https://feedback.neon.tech/ (no auth required).