TechFabricTechFabricHarness
Getting Started

TechFabric Harness in 5 minutes

Run your first agent in one file with zero credentials, or scaffold a full workspace.

The fastest path needs no workspace, no Docker, and no API keys: install the CLI, write one file, run it. The mock model answers offline; add a provider key later without changing the agent.

1. Install the CLI

npm install -g @fabric-harness/cli

This provides the fabric-harness binary (alias fh). Inside a project, prefer the version pinned by that project (npx fh) over a global install — see Installation.

2a. Run one file (no workspace)

Write agent.ts:

agent.ts
import { defineAgent, schema } from '@fabric-harness/sdk';

export default defineAgent({
  name: 'hello',
  input: schema.object({ message: schema.string() }),
  output: schema.string(),
  run: async ({ init, input }) => {
    const fabric = await init();
    const session = await fabric.session();
    return session.prompt(input.message);
  },
});

Run it:

fh run ./agent.ts --message "hi"
[fabric-harness] no model credentials resolved; using the mock model (set FABRIC_MODEL or pass --model for a real provider).
[fabric-harness] session hello-4edbadf5-… completed (memory store — not persisted).
Mock response: hi

fh run transpiles the file on the fly, resolves @fabric-harness/sdk from the nearest node_modules (falling back to the CLI's own install), and — because no model credentials resolve — falls back to the deterministic mock model. The full model loop, schema validation, and session lifecycle still execute. See fh run single-file mode for multi-export files and payload flags.

2b. Or scaffold a workspace

A workspace adds discovery, persistent agents, config, and deployment targets. The scaffold and the first run also work offline:

npx @fabric-harness/cli init my-agent --template minimal
cd my-agent
npm install
npx fabric-harness agents
npx fabric-harness run hello --name Preetham --mock
hello                Greet a user.
Mock response: Say hello to Preetham.

Validate readiness — Node, ESM setup, dependencies, agent discovery, session storage, model resolution, and tool schemas:

npx fabric-harness doctor --getting-started --tools

Or start the HTTP/SSE dev server:

npx fabric-harness dev --mock
curl http://localhost:3000/jobs/hello \
  -H 'content-type: application/json' \
  -d '{"name":"Preetham"}'
# {"result":"Mock response: Say hello to Preetham.","runId":"…"}

Create more definitions without writing boilerplate:

npx fabric-harness new job summarize-report
npx fabric-harness new agent support

3. Test without credentials

Everything above runs offline. The same mock story extends to unit tests, mock sandbox handles for remote providers, and fh test eval suites — see Test without credentials.

4. Add a real model

Put a provider key in .env.local; TechFabric Harness auto-loads it and shell env still wins:

echo 'OPENAI_API_KEY=sk-...' > .env.local
npx fabric-harness doctor --live --model openai/gpt-5.5
npx fabric-harness run hello --name Preetham        # or: fh run ./agent.ts --message "hi" --model openai/gpt-5.5

See Model providers for the supported providers and credential resolution order.

Choose the next runtime

NeedUse
Fast no-container agentsandbox: 'virtual'
CI/repo automation with host toolssandbox: 'local' plus scoped defineCommand() commands
Untrusted code or data analysisDocker sandbox
Human approval delays or restart durabilityTemporal runtime
Edge/serverless endpointCloudflare target

Start with the minimal template, then add only the enterprise controls your use case needs: policy, approvals, audit, cost budgets, durable workflows, and deployment attestations.