@finalai/agents
SDK for defining, publishing, and using agents. Authoring helpers are implemented in
@finalai/agent-definition; Final-specific bindings come from
@finalai/final-agent-provider.
import { defineAgent } from '@finalai/agents';
import { serverlessPi } from '@finalai/agents/harnesses';
export default defineAgent({
name: 'Assistant',
harness: serverlessPi({
credentials: { payer: 'agent-owner', tryInOrder: [{ kind: 'platform' }] },
}),
});
Use @finalai/agents/client for definitions, sessions, conversations, approvals,
attachments, schedules, sandbox access, and realtime. Use final-agents --help
for CLI commands. Compilation requires Node 26 and ships its assets through
agent-definition.
Credential-chain declarations select which credentials an agent may use and in which order. Set the payer policy explicitly in the harness configuration.
For custom provider implementations, import contracts from @finalai/agent-provider,
sandbox adapters from @finalai/agent-provider/sandbox, and conformance tools from
@finalai/agent-provider/conformance. Run a harness check with
final-agents conformance ./harness.ts.
Use FINAL_API_HOST with FINAL_API_KEY to select a deployment once for build and
publish; an explicit --host overrides it. Use defineHostedConnection for a named
connection resolved by hosting at session start. defineFinalConnection() uses
the same path with the final binding. Explicit URL declarations remain static.
See the repository's hosting guide for provider contexts,
resource lookup, and the required hosting integration.