FabricFabricHarness
Getting Started

Agent APIs

The canonical APIs for finite, persistent, and provider-backed Fabric Harness agents.

Fabric Harness has one public builder for each agent lifecycle:

LifecycleAPI
Finite, run-once agentdefineAgent({ ... })
Persistent, addressable agentcreateAgent(AgentFunction, staticConfig?)
Databricks-backed finite agentdefineDatabricksAgent({ ... })
Azure-backed finite agentdefineAzureAgent({ ... })
Cloudflare-backed finite agentdefineCloudflareAgent({ ... })

Finite definitions receive the typed AgentRunContext with lazy session, prompt, skill, task, shell, and invoke helpers:

import { defineAgent } from '@fabric-harness/sdk';

export default defineAgent<{ question: string }, string>({
  run: ({ input, prompt }) => prompt(input.question),
});

Persistent definitions use a synchronous function and hooks. The returned string is the current instruction; static policy and durability remain visible to the host before the function renders:

import { createAgent, useModel, useSandbox } from '@fabric-harness/sdk';

function Assistant() {
  useModel('anthropic/claude-sonnet-4-6');
  useSandbox('virtual');
  return 'Resolve the request, verify the answer, and explain the next step.';
}

export default createAgent(Assistant, {
  durability: { maxAttempts: 5, timeoutMs: 60 * 60_000 },
});

Provider definers accept typed custom control flow and inject their resolved bundle:

import { defineDatabricksAgent } from '@fabric-harness/databricks';

export default defineDatabricksAgent<{ question: string }, string>({
  run: async ({ databricks, input, prompt }) => {
    console.log(`Using ${databricks.tools.length} governed Databricks tools`);
    return prompt(input.question);
  },
});

Omitting run uses the provider definer's question-and-answer behavior. Explicit provider configuration is resolved first; otherwise the definer uses request environment variables and supports FABRIC_MOCK=1. Definition tools override same-named bundle tools, policies compose as security floors, and all standard definition fields—including target, subscriptions, middleware, and init—are forwarded consistently.

Provider bundle factories remain separate and composable: use databricks(), azure(), cloudflare(), node(), docker(), or another backend factory when you want to assemble the runtime yourself. pnpm examples:check prevents removed aliases from returning to public examples or scaffolds.