Day 5, 25 minutes · beginner
Why it matters
How do you make an agent do its work every week without anyone asking? So far your agent waits until someone asks. Some team work should simply happen: a Monday overview of current lead times, a weekly reminder of a rule people forget, a short summary before the planning meeting. If someone has to remember to ask, it stops after three weeks.
A workspace agent can run on a schedule, and post its result in ChatGPT or in a connected Slack channel. It can also be started by another system through an API trigger, for example when a form is sent in. Both run without anyone watching, so the instructions have to be tighter than for a chat.
At the end of today your agent has one weekly scheduled run with its own short instructions, and you know what an API trigger needs and who has to set it up.
Scheduled runs
OpenAI's workspace agents page calls a schedule an automation. You choose the channel the run belongs to (ChatGPT, or a Slack channel you connected in lesson 4), the schedule and how often it runs, and you can add instructions for that run only. The ChatGPT Agents app in Slack page adds that an agent on a schedule can send its results to a Slack channel, and that you publish the Slack channel before adding automations.
Write the run instructions as if nobody will read them twice:
- What to do: "Post the current lead times from lead-times.txt."
- Where to put it: "Post one short message, no more than ten lines."
- What if a source is missing: "If the file is missing or empty, say so in one line and post nothing else."
- What never to do: "Do not change any file. Do not mention customers by name."
Start with a weekly run, not a daily one. Runs count against your workspace's included usage or credits (lesson 6), and a weekly run gives you time to read each result.
API triggers: what they are and who sets them up
An API trigger lets another system start the agent. OpenAI's examples are meeting follow-ups, routing vendor and approval requests, and handling new leads. You add an API channel in the builder, and a system sends a request with the input text. OpenAI's developer page Trigger workspace agent runs shows the request shape. This example is made up; the ID and token are placeholders, and nothing here was run:
curl https://api.chatgpt.com/v1/workspace_agents/agtch_example_123/trigger \
-X POST \
-H "Authorization: Bearer $AGENT_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input":"A new sign request came in. List the questions sales must ask the customer."}'
Four facts from that page and the authentication page:
- The token is an admin matter. A workspace admin must turn on workspace agents and allow users to create personal access tokens. Then a token with the Workspace Agents scope is made under Admin, Access tokens, and kept in a secrets manager. Never paste a token in a chat, a document or a Slack message.
- The call only queues the run. The answer is
202 Acceptedwith a link to the ChatGPT conversation, and OpenAI notes that link can be empty (null). OpenAI says the agent's reply cannot currently be retrieved through the API. - Status checks are in beta. With an extra beta header you get a run ID you can poll for
queued,in_progress,suspended,completedorfailed. - Out of credits shows as a conflict. A
409 Conflictwith the codeinsufficient_workspace_creditsmeans the workspace ran out of credits: ask your admin.
For most teams, the API trigger is something to plan with a developer, not to build on day five. Today you only write down what you would trigger and who would set it up.
Team tasks: a related feature
ChatGPT also has team tasks: recurring work owned by a team in ChatGPT, run in the cloud under the team's service account. OpenAI's page Creating and managing team tasks names Business and Enterprise workspaces; the release notes announced it for Business. It is a different feature from a workspace agent's schedule. If your team wants a shared recurring task without building an agent, ask your admin about team tasks.
The steps
- Pick one recurring job for your agent, weekly.
- Write the run instructions with the four parts above.
- Add the automation to the ChatGPT channel or your test Slack channel.
- Note when the first run is due, and check its result after it has run (lesson 6 makes that part of your review).
- Write one line about what you would start through an API trigger, and who would set it up.
Pick your tool below and follow the steps.
Example: the Monday lead times
Every Friday Freya swaps the agent's lead-times.txt for Duco's new version. Freya added a weekly automation to #ask-the-workshop for Monday morning: "Post the current lead times from lead-times.txt as a short list, one line per product, at most ten lines. Do not add anything that is not in the file." The first Monday the list was right but had twelve lines, because the file has twelve products. She changed the instruction to the six products sales asks about most. Since then the Monday post has cut the lead time questions in the channel by half, Mabel guesses. For the API trigger Freya wrote one line: "Later: start the agent when the web quote form comes in. Needs Bastiaan for the token and our web developer."
Today's actions
Ticks are not saved without an accountDo it in ChatGPT
ChatGPT
- Open your agent in Agents and select Automations on the agent page.
- Choose the channel: ChatGPT, or the Slack channel you connected in lesson 4.
- Choose the schedule and how often it runs (run every), for example once a week on Monday morning.
- Add the run instructions in the extra instructions field.
List the questions from the past week that you answered with Not in the handbook. One line per question. At most ten lines. If there were none, say so in one line. Do not change any file. Do not mention customers by name. - Select Add automation. To change it later, open Automations again and select Update automation.
- Note when the first run is due. After it has run, read the result where it was posted and tighten the instructions if it was too long or off topic.
Note: The page also describes the same flow from the ChatGPT channel page with Add automation. For Slack, publish the channel before you add automations. An API trigger needs an API channel in the builder and an access token that only works after an admin setting.
Paid planNeeds a ChatGPT Business, Enterprise or Edu workspace with agent building on. Runs use your workspace's included usage or credits.
Create a free account to save your progress
Free, and no payment details. Your ticks and finished lessons are kept, on every device.
Create a free account I already have an accountCreate a free account to save your progress. Sign in or sign up