SDK Agent Module

Use @hostfunc/sdk/agent to create and run autonomous jobs with structured status and step traces.

SDK API Reference

createAgent

await createAgent(config: AgentConfig): Promise<AgentResult>

Create an agent run record and schedule execution with the given configuration.

Returns

AgentResult with id, status, timestamps, and step history.

runAgent

await runAgent(config: AgentConfig): Promise<AgentResult>

Start agent execution immediately and return the current run state.

Returns

AgentResult with current status and collected steps.

SDK Code Examples

Simple triage agent

Run an agent that can call selected tools/functions.

typescript
import { runAgent } from "@hostfunc/sdk/agent";const run = await runAgent({  name: "incident-triage",  goal: "Classify incidents and trigger escalation functions.",  maxSteps: 6,  tools: ["functions.execute", "executions.list"],});

Best Practices

  • Set maxSteps and timeoutMs to keep agent runs bounded.
  • Restrict tools to least-privilege capabilities for each agent role.
  • Agent execution uses the same AI provider resolution chain as other AI helpers.

Related Documentation