{ "cells": [ { "cell_type": "markdown", "id": "0b78366e", "metadata": {}, "source": [ "# Trigger a Workspace Agent from the API\n", "\n", "Workspace Agents let teams save repeatable work in ChatGPT: instructions, connected context, app actions, approvals, and output format. API triggers let another system start that saved workflow when work begins outside ChatGPT.\n", "\n", "In this notebook, you send one source event, confirm the trigger was accepted, and verify the result in the agent's destination. The API starts the run. The instructions, app permissions, and approval settings control what happens next.\n", "\n", "*API-triggered runs are asynchronous. The endpoint queues the run, but it does not return the completed agent response.*\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## What you will build\n", "\n", "By the end, you will have a saved Workspace Agent, an API channel with an `agtch_...` trigger ID, and a Python trigger call that can run live against your agent.\n" ] }, { "cell_type": "markdown", "id": "3f33fe77", "metadata": {}, "source": [ "## Prerequisites\n", "\n", "Before running the live trigger cell, you need:\n", "\n", "| You need | Use this doc |\n", "| --- | --- |\n", "| Workspace Agents enabled in a supported ChatGPT workspace, plus permission to create and share agents | [ChatGPT Workspace Agents guide](https://help.openai.com/en/articles/20001143-chatgpt-workspace-agents-for-enterprise-and-business) |\n", "| A saved Workspace Agent with one destination it can write to | [Create and manage Workspace Agents](https://help.openai.com/en/articles/20001143-chatgpt-workspace-agents-for-enterprise-and-business) |\n", "| An API channel on that agent and its `agtch_...` trigger ID | [Trigger workspace agent runs](https://developers.openai.com/workspace-agents/trigger-runs) |\n", "| A Workspace Agent access token with the Workspace Agents scope | [Authenticate with Workspace Agent access tokens](https://developers.openai.com/workspace-agents/authentication) |\n", "| A notebook or backend environment that can send HTTPS `POST` requests | This notebook uses Python's standard library. No OpenAI Platform SDK is required. |\n", "\n", "One async detail matters: the HTTP request returns before the agent finishes. The destination can be any connected app or surface the agent can write to, such as a channel, document, email, or ticket.\n", "\n", "Check the Help Center for current plan and regional availability.\n" ] }, { "cell_type": "markdown", "id": "a368a27c", "metadata": {}, "source": [ "## Architecture\n", "\n", "The source system decides when work starts. The Workspace Agent decides how the saved workflow runs using its instructions, context, apps, and approvals.\n", "\n", "
\n",
" \n",
"
\n",
"
\n",
"
\n",
"
\n",
"
\n",
"
\n",
"
\n",
" \n",
"