host
Bind agents to a store, channels and schedules.
Starts nothing until ready().
Import from @threads/host (TypeScript) or threads.host (Python).
function host(options: {
store: Store;
agents: Record<string, Agent<unknown, unknown>>;
channels?: Record<string, ChannelAdapter>;
ceiling?: Partial<Policy.permissions>;
schedules?: readonly Schedule[];
authenticate?: (request: Request) => Promise<Principal | null>;
}): HostParameters
storeStorerequiredThe store every bound agent's threads, runs and host records live in. See Store.
agentsRecord<string, Agent<unknown, unknown>>requiredKeyed by the name channels, schedules and the HTTP API use.
channelsRecord<string, ChannelAdapter>default {}A channel thread's replies are derived from its log, whatever ran it: each end_turn reply and each open approval card is a host-issued channel_send, issued after every run of the thread and, for a crash in between, again after ready(). A send with a result or a parked effect is never issued twice.
ceilingPartial<Policy.permissions>The host ceiling every run this host starts or resumes is also decided under (Agent.run ceiling). Omitted: no ceiling.
schedulesreadonly Schedule[]default []The schedules the host fires once ready() has run. Default [] fires none.
authenticate(request: Request) => Promise<Principal | null>Maps an HTTP API request to a principal, or null for 401. Omitted: every /v1 route answers 401; channel webhooks still work.
authenticate(request)RequestrequiredThe incoming HTTP request, to read its headers or cookies: a fetch Request in TypeScript, a Starlette Request in Python.