Returns
Returns an Endpoint Connection object for the given parameters, orNone if an error occurs. When the platform stores it but cannot return it, create raises WrittenResourceUnreadableException instead: do not create it again.
Example
Parameters
string
required
Name of the endpoint connection. Must be unique per product.
string
required
ID of the product this connection belongs to.
string
required
The endpoint URL (HTTPS, or WSS for a WebSocket agent). For multi-step session lifecycles, the URL supports a
{{ session_id }} placeholder for dynamic session IDs (e.g., https://api.example.com/v1/threads/{{ session_id }}/messages). Only available when an INITIALIZATION endpoint connection returns a session_id.string
required
Type of endpoint connection. Valid values:
INITIALIZATION, CONVERSATION, FINALIZATION.
CONVERSATION is required for all products. INITIALIZATION and FINALIZATION are only needed
for complex session management
(e.g., when your API requires a separate setup call that returns a session ID, or a cleanup call
after the conversation ends). Other string values are sent to the API unchanged, so values added
in newer API versions can be used; the API rejects invalid ones.string
default:"POST"
HTTP method. Valid values:
GET, POST, PUT, PATCH, DELETE. Defaults to POST. Other string
values are sent to the API unchanged, so values added in newer API versions can be used; the API
rejects invalid ones.string
default:"BEARER"
Authentication type. Valid values:
NONE, BEARER, API_KEY, BASIC. Defaults to BEARER. Other
string values are sent to the API unchanged, so values added in newer API versions can be used;
the API rejects invalid ones.string
Authentication token. Required for
BEARER and API_KEY auth types.string
Username for
BASIC authentication.string
Password for
BASIC authentication.dict[string, string]
Custom headers as key-value pairs. Supports placeholders: credentials (e.g.,
{{ bearer_token }}, {{ api_key }}) and call values (e.g., {{ trace_id }}, {{ session_id }}). See Custom Headers.string
Input template with Jinja2 placeholders. Required for
CONVERSATION type. Must name at least one input field, such as {{ input.user_message }}. Add {{ input_files[0].url }} or {{ input_files[0].base64 }} to send an attached file to your endpoint. A test case that attaches files is refused without one of them. See Templates & Mapping.dict[string, string]
Output mapping configuration using JSONPath expressions. The API refuses a filter expression such as
[?(...)]. Required for INITIALIZATION (needs session_id) and CONVERSATION (needs output) types. See Templates & Mapping.int
Per-attempt request timeout in seconds. Defaults to
15. Maximum 120 (values above this are rejected by the API).int
Maximum requests per minute. Leave empty for no limit (no throttling).
bool
Whether automatic retry is enabled. Defaults to
true. See Retry Configuration.int
Maximum retry attempts (0–10). Defaults to
1. These are retries after the first call, so N attempts means up to N+1 calls to your endpoint, and each call uses credits. 0 is only valid when retry is disabled; with retry enabled the minimum is 1.int
Initial delay in milliseconds before first retry. Defaults to
1000.string
Backoff strategy. Valid values:
FIXED, EXPONENTIAL, LINEAR. Defaults to EXPONENTIAL. Other
string values are sent to the API unchanged, so values added in newer API versions can be used;
the API rejects invalid ones.int
Maximum delay between retry attempts, in milliseconds. Defaults to
3000. Capped at 60000; values above this are rejected.list[int]
HTTP status codes that trigger retry. Defaults to
[429, 500, 502, 503, 504]. Each value must be a valid HTTP status code (100–599).bool
Set to
true to accept an http:// or ws:// URL. Required when url is not encrypted (HTTPS or WSS), unless the deployment allows plain HTTP for every connection. See HTTP Endpoints.list[ConversationEndRule]
Replies that mean your agent ended the conversation. On a match, the session completes and is evaluated instead of failing, and the match is never retried. Each
ConversationEndRule has a status_code (100–599) and an optional body_match, a ConversationEndBodyMatch with a JSONPath path and the expected value equals. A 2xx rule needs a body_match. At most 20 rules, and only for CONVERSATION type. Defaults to no rules. For example, ConversationEndRule(status_code=409, body_match=ConversationEndBodyMatch(path="$.error.code", equals="conversation_ended")). See Conversation End Rules.string
How your agent frames a streamed reply:
SSE (Server-Sent Events), NDJSON (one JSON object per line), WEBSOCKET (one message per chunk, on a wss:// or ws:// URL) or GRPC (one reply message per chunk, from the method that the URL path names; needs grpc_schema). Defaults to None, which reads one plain JSON reply. Set it together with stream_assembly. Other string values are sent to the API unchanged, so values added in newer API versions can be used; the API rejects invalid ones. See Streamed Replies.StreamAssembly
How a streamed reply becomes one object
{ text, byEvent, final, json } that output_mapping reads, so output is usually $.text. Required when stream_format is set.Use a named preset alone, for example StreamAssembly(preset="OPENAI_CHAT_COMPLETIONS"). The presets are OPENAI_CHATKIT, OPENAI_RESPONSES, OPENAI_CHAT_COMPLETIONS, ANTHROPIC_MESSAGES, GOOGLE_ADK and VERCEL_AI_SDK. They come from GET /endpointConnections/streamPresets, which also gives the stream format each preset needs and the settings it fills. A preset name that a newer API adds can be passed as a plain string.For any other stack, use CUSTOM (or no preset) with these settings:text_path: JSONPath to the text in each chunk, for example$.delta.text. Required.mode:APPENDjoins the text of every chunk;LASTkeeps the text of the last chunk. Required.event_field: JSONPath to the event name in each chunk. Unset uses the SSE event name.terminal_event: the event name, or the raw chunk data (for example[DONE]), that ends the reply. Unset reads to the end of the stream. WithWEBSOCKET, unset ends the reply atquiet_period_secondsinstead.text_event: the only event whose chunks give text. Unset takes text from every chunk.error_event: the event name that fails the turn, with the event data in the error. WithNDJSON,WEBSOCKETorGRPC, setevent_fieldtoo. A named preset fills its ownerror_event, so the API answers400to a preset sent witherror_eventbeside it.quiet_period_seconds:WEBSOCKETonly. The reply ends after this many whole seconds (1 to 30) with no message. It starts at the first message that gives text, so a slow first token is never cut. An agent that sends heartbeat messages, or a reply with no text, needsterminal_event. AWEBSOCKETconnection needs it orterminal_event. It needs an SDK newer than 5.21.
GrpcSchema
GRPC only, and required there: the message types of your agent. GrpcSchema(format="PROTO", content=...) takes the text of one proto3 .proto file, which may import only the google/protobuf files, google/rpc/status.proto, and these google/api files: annotations.proto, client.proto, field_behavior.proto, http.proto, launch_stage.proto and resource.proto. GrpcSchema(format="DESCRIPTOR_SET", content=...) takes a base64 FileDescriptorSet, for a schema of several files. The method that the URL names must be in it, as a unary or a server-streaming method. A connection read from list holds the format only. See gRPC Agents.string
GRPC only. A PEM client certificate, for an agent that asks for one (mutual TLS). Set it together with grpc_client_key. Galtea stores it encrypted and never returns it: a read answers has_grpc_client_certificate.string
GRPC only. The PEM private key of grpc_client_certificate, without a passphrase. Galtea stores it encrypted and never returns it: a read answers has_grpc_client_key.string
GRPC only. A PEM CA certificate that this connection trusts, in addition to the public roots, for an agent whose certificate a private CA signed.Streaming Example
With a preset, for an agent stack that Galtea knows:CUSTOM, for an agent with no preset. This one sends its text in delta chunks and ends with a done event:
WebSocket Example
An agent that answers over a WebSocket gets the renderedinput_template as one message. Every stream preset streams SSE, so set text_path and mode yourself, and say when the reply ends. See WebSocket Agents.
gRPC Example
The URL path names the method of your agent, andgrpc_schema gives its message types. The input_template renders the JSON of the request message, and each reply message is one chunk with lowerCamelCase names. No preset fits gRPC, so set text_path and mode yourself. See gRPC Agents.