API integrations declare an external HTTP API in YAML, so functions and flows can call it as conv.api.<name>.<operation>(…) instead of hand-rolling request code.
Location
api_integrations key. The file is optional — omit it if the project makes no external HTTP calls.
What an API integration contains
Identity
A name (the runtime namespace) and an optional description.
Environments
Separate base URL and auth type per
sandbox, pre-release, and live.Operations
The HTTP endpoints exposed as callable methods.
Fields
Environments
Each integration configuressandbox, pre-release, and live separately, so you can point at a staging API in sandbox and promote to production without touching code:
Credentials themselves are managed by Agent Studio, not stored in the YAML — see Usage below.
Operations
Each entry is one HTTP endpoint:
The optional fields are omitted from the file when empty, and removing one from the file clears it in Agent Studio on the next push.
Schemas are nested YAML, not JSON strings, so quote values YAML would otherwise type for you:
type: "null", a pattern or const that looks like a date or a number. Schemas written in Agent Studio or imported from an OpenAPI document pull down unchanged and push back as they were.
Example
Usage
- Calling an operation —
conv.api.<api_name>.<operation_name>(...)from a function or flow. Path variables can be passed positionally or as keyword arguments. - Return value — a
requests.Response-like object; use.status_code,.text, and.json()as normal. - Extra request data — pass
params,json,headers, etc. as keyword arguments, same as a standard HTTP client. - Authentication — configured per environment at the API level; credentials are managed by Agent Studio and never appear in the YAML or in function/flow code.
Validation
nameis required, at least 2 characters, and must match^[a-z_][a-z0-9_]*$.- Each integration
namemust be unique. - Each environment’s
base_urlmust be a validhttp(s)://URL, or empty. base_urlcannot be empty whenauth_typeis notnone.auth_typemust be one ofnone,basic,apiKey,oauth2,oauth2_client_credentials,jwt_client_assertion.- Every operation needs a
namematching^[a-z_][a-z0-9_]*$, amethodfrom the supported set, and aresourcepath matching a valid URL-path pattern (optionally with{param}placeholders). - Each operation
namemust be unique within its integration. - An operation’s
descriptionis at most 1000 characters. - Header names are HTTP tokens (letters, digits and
!#$%&'*+-^_`|~), unique ignoring case, and neverAuthorizationorHost. Values are text, so quote one YAML would otherwise read as a number, date, list or mapping (X-Version: '1.10');trueandfalseare sent as written. Values are ASCII with no line breaks or control characters, don’t start or end with a space, and are at most 4096 characters. An operation has at most 50 headers. - Each schema is a mapping that passes the JSON Schema 2020-12 meta-schema, nests objects and arrays at most 64 levels deep, and is at most 64 KB as compact JSON. A
$schemakeyword, if present, must behttps://json-schema.org/draft/2020-12/schema. request_body_schemais not allowed onGETorDELETEoperations.response_schemaskeys match^([1-5]\d{2}|[1-5]XX|default)$.schema_sourceis one ofdefault,manual,observed,openapi.$ref,$idand$schemavalues must be valid URIs. The ADK does not check this locally; Agent Studio refuses them on push.- A
patternmust compile as a JavaScript regular expression with theuflag. Agent Studio checks this on push;poly validatedoes not, since Python’s regex syntax differs.
Best practices
- name operations for what they do (
get_contact, notop1) - check
response.status_codebefore trustingresponse.json()— a failed call still returns a response object - keep credentials in Agent Studio’s managed auth, never hard-coded in a function
Related pages
Functions
Call API integrations from global functions, lifecycle hooks, and function steps.
Flows
Call API integrations from advanced-step and transition-function prompts.
Tests
Mock an operation’s response with
api_mocks so a conversation that branches on it can be tested deterministically.
