The workspace
Open Foundry from the sidebar. The left panel has two tabs:- Functions. Every function in your workspace, with their last test status (Passing, Failing, or Never run). Click New Function to start a new one.
- Integrations. Every integration available to Foundry. The New Integration button takes you to Settings.
- Chat. The conversation Foundry uses to generate and refine code.
- Test. Run the function with sample inputs.
- Integrations. Connect or disconnect integrations for this function.
- Configure. Edit the name, description, and AI tool prompt, or delete the function.
Build a function
Create the function
Connect integrations
Describe what it should do
List all active users and return their name, email, and role
Create a project with the given name, description, and team
Look up a contact by email and return their company and last activity date
Test with real inputs
Refine in chat
Add pagination so it fetches every page.
If the API returns a 429, wait and retry up to 3 times.
Only return users where status is active.
Publish
Idle, In progress, Success, or Error) in the function workspace, so if a generation stalls or fails, you can see why.Version history
Foundry snapshots a function every time its code changes, so you can go back to a version that worked.Version numbers
Two numbers track a function, and they move for different reasons:- The published version (
published v3in the workspace header) is the release number. It only moves when you publish. - The internal revision moves on every code write: an AI generation, a hand edit in the editor, or a checkpoint restore. It is what tells Foundry whether your draft has drifted from what is live, and it is why a test result recorded against an older revision is flagged as stale.
published v3 while you make ten draft edits. Publishing again makes it v4.
Restore a checkpoint
Every code-changing step in the Chat tab gets a Checkpoint marker with its timestamp. Click Restore on a marker to roll the function back to that point. Restoring reverts the code, schemas, settings, and integration bindings, and rewinds the chat to that point so the conversation matches the code. Your current state is saved as a checkpoint first, so a restore is itself reversible. The checkpoint at your current state shows the marker without a Restore option, since there is nothing to change.Roll back the published version
Publishing also records a checkpoint, which gives you a deployable history. Click the published v3 badge in the function workspace header to open Publish history, pick an earlier version, and confirm. A rollback reverts the code, schemas, settings, and integration bindings to that version and re-publishes, so anything running picks up the old code right away. Two differences from a checkpoint restore:- Your chat is preserved. A rollback is a deployment operation, not a rewind of your work, so the conversation stays where it is.
- It publishes a new version rather than reusing the old number. Rolling back from
v5tov3producesv6, annotated↳ rolled back to v3in the history so you can tell the two apart.
Dry Run mode
Dry Run lets you exercise a function end-to-end without changing external state. Use it to safely test functions that send email, create tickets, post messages, or update records. Turn on the Dry Run toggle in the function workspace header, then click Run Test from the Test tab as usual. When you publish a function, Foundry analyzes the code and picks one of two strategies. The active strategy shows up in the toggle’s tooltip:- Dry Run is available once a function has been published or had its dry-run code generated. New, never-published functions show the toggle disabled.
- The code editor switches to read-only while Dry Run is on, and a banner tells you which strategy is active. Turn Dry Run off before editing.
- Each mocked write is logged in the test output so you can see exactly what the function would have done.
- If you change the function and the dry-run variant looks stale, click the Sparkles button next to the toggle to regenerate it. Only workspace admins can regenerate dry-run code.
dryRunis also exposed on thePOST /foundry/actions/run-testAPI via theuseDryRunVariantflag.
Advanced: the ActionContext SDK
This section is for users who want to read or hand-edit the generated TypeScript code. You don’t need any of this to build, test, or publish a function. Every function exports arun function that receives an ActionContext. The context gives you authenticated HTTP clients (one per integration), the Ravenna operations namespace, and runtime info.
Context properties
ctx.fetch, ctx.baseUrl, and ctx.auth still exist for backwards compatibility but are deprecated. They point at the primary integration. New code should use ctx.integrations.<slug> so it keeps working when more integrations are added to the function.Ravenna operations
Available onctx.ravenna:
Tickets: createTicket, updateTicket, addTicketComment, setTicketStatus, setTicketPriority, setTicketAssignee, addTicketFollowers, addTicketTags, moveTicket
Users: getUser
Slack is not a ctx.ravenna operation. To post to Slack from an action, select the Slack integration and call the Slack Web API directly with ctx.integrations.native_slack.fetch. Your workspace’s bot token is attached automatically, so you pass Slack arguments only (such as channel and text), never a workspace or team id.
Advanced: how generation and testing work
Foundry validates generated code in two phases, automatically:- TypeScript compilation catches syntax errors, type mismatches, and bad imports. Foundry auto-fixes failures up to 3 times.
- Dry-run execution runs the code in a sandbox without making real API calls, to catch issues like malformed URLs. Foundry auto-fixes failures up to 2 times.
development, staging, or production) that the function sees via ctx.env. The function runs in an isolated sandbox with the credentials resolved for each of its integrations, limited to 30 seconds per execution.
When you publish, Foundry runs a final validation, then generates an AI tool prompt that helps agents decide when to call the function. You can regenerate that prompt from the function’s Configure tab.