Gestalt Rust SDK
Use the Rust SDK to build compiled Gestalt providers with typed routers,
serde input and output types, and schema-derived catalog metadata.
The package is published to crates.io as gestalt-sdk, while Rust code imports
the crate as gestalt.
API sections
The docs.rs reference is organized around the provider-authoring workflow. Most
provider code imports from the crate root after renaming gestalt-sdk to
gestalt.
| Section | Start with | Use it for |
|---|---|---|
| Provider authoring | [Provider], [Operation], [Router], [Request], [HTTPSubjectRequest], [Response], [ok] |
Executable app providers, typed request handlers, hosted HTTP subject hooks, and operation results. |
| Catalog metadata | [Catalog], [CatalogOperation], [Router::register] |
Schema-derived operation catalogs from serde and schemars types. |
| Provider runtimes | [AuthenticationProvider], [CacheProvider], [S3Provider], [SecretsProvider], [WorkflowProvider], [AgentProvider], [RuntimeProvider] |
Host-service backends implemented as Rust providers. |
| Workflow and agent models | [new_bound_workflow_target], [new_workflow_definition], [new_workflow_run], [new_workflow_signal], [new_agent_message], [new_agent_tool_ref] |
Native workflow values, agent messages, tool refs, and copy helpers. |
| Host-service clients | [Cache], [S3], [Workflow], [Agent], [App] |
Calling sibling services exposed to a provider process by gestaltd. |
| Runtime and telemetry | [runtime], [telemetry], [RuntimeMetadata] |
Provider process entrypoints and provider-authored GenAI spans and metrics. |
Quick start
Register typed operations on a router. The router dispatches requests and emits
catalog metadata for gestaltd.
use JsonSchema;
use ;
use Arc;
;
export_provider!;
Fields are required unless they are modeled as Option<T> or have a serde
default. Use schemars attributes for catalog descriptions.
Provider surfaces
Use Provider, Operation, Router, and export_provider! for integration
providers. Use the other provider traits and export macros when you are serving
a host-service backend.
| Trait | Export macro | Use it when you want to serve |
|---|---|---|
AuthenticationProvider |
export_authentication_provider! |
Login flows. |
CacheProvider |
export_cache_provider! |
App-bound cache storage. |
S3Provider |
export_s3_provider! |
S3-compatible object storage. |
SecretsProvider |
export_secrets_provider! |
Secret resolution. |
WorkflowProvider |
export_workflow_provider! |
Workflow definitions, activations, runs, events, and run output. |
AgentProvider |
export_agent_provider! |
Agent sessions, turns, events, interactions, and capabilities. |
RuntimeProvider |
export_runtime_provider! |
Hosted app execution backends. |
The crate also exposes clients for sibling host services, including Cache,
S3, Workflow, Agent, and App.
Calling sibling host services
Each host-service client connects from the environment with
connect()/connect_named(name) and exposes one method per RPC with
flattened parameters, plus a _raw sibling that takes the full request
message. Optional parameters ride in a per-method options struct (for
example AppInvokeOptions) whose default value leaves every option unset.
Contextful clients (App, Agent, Workflow) accept a default request
context through with_context(...); outgoing requests that leave the context
unset get the default injected. Every client accepts a per-call deadline
through with_timeout(...); unary calls that run past it fail with
DEADLINE_EXCEEDED.
# async
AgentProvider implementations receive and return native structs such as
CreateAgentProviderTurnRequest, AgentSession, AgentTurn, and
AgentTurnEvent. Structured payload fields use serde_json::Value and
timestamp fields use SystemTime; the SDK runtime owns transport serialization
at the transport boundary.
Workflow builders such as new_bound_workflow_target,
new_workflow_definition, new_workflow_run, and new_workflow_signal
accept SDK-owned input structs and preserve request shape without asking
provider code to assemble transport objects.
Public surface
The crate exposes higher-level authoring APIs:
Provider,Request,Response, andok(...)model integration providers.HTTPSubjectRequestandProvider::resolve_http_subjectlet executable apps map verified hosted HTTP requests to concrete subjects.RouterandOperationregister typed operations and derive catalog metadata fromserdeandschemars.AuthenticationProvider,CacheProvider,S3Provider,SecretsProvider,WorkflowProvider,AgentProvider, andRuntimeProvidermodel executable provider runtimes.Cache,S3,Workflow,Agent, andAppcall sibling host services.RuntimeMetadatalets provider runtimes describe their display metadata and version.- Workflow builder inputs such as
BoundWorkflowTarget,WorkflowStep,WorkflowActivation,WorkflowDefinition,WorkflowSignal, andWorkflowRunmodel provider-owned workflow state.
Package layout
This package intentionally lives outside the existing gestalt/ Cargo
workspace so the SDK can evolve independently of the CLI crate graph.