SDK
AgentSDK
TypeScript SDK for building AI agents. Define bots, entities, and workflows with decorators. Full type safety with IDE autocomplete.
Installation:
npm install @firefoundry/agent-sdk
Build Agents with TypeScript
The AgentSDK is how you build AI agents on FireFoundry. Use TypeScript decorators to define bots, entities, and workflows. The SDK handles persistence, context, and platform integration automatically.
Core Concepts
- @Bot: Conversational agents that respond to messages
- @Entity: Persistent business objects with automatic state management
- @Workflow: Multi-step processes with checkpointing and resumption
- @Skill: Reusable capabilities that bots can invoke
- @Tool: Functions that AI can call to take actions
Why Decorators
Decorators let you write clean, readable code while the SDK handles the complexity. Your business logic stays front and center, while persistence, serialization, and platform integration work automatically.
Define a bot:
import { Bot, Tool } from '@firefoundry/agent-sdk';
@Bot({
name: 'customer-support',
modelGroup: 'gpt-production',
systemPrompt: 'You are a helpful customer support agent.'
})
class CustomerSupport {
@Tool()
async lookupOrder(orderId: string) {
// Tool implementation
return await orders.find(orderId);
}
@Tool()
async createTicket(issue: string, priority: string) {
// Create support ticket
return await tickets.create({ issue, priority });
}
}
Define an entity:
import { Entity, Field, Relation, Runnable } from '@firefoundry/agent-sdk';
@Entity({ name: 'order' })
class Order {
@Field() status: 'pending' | 'processing' | 'shipped' | 'delivered';
@Field() items: OrderItem[];
@Field() total: number;
@Relation('customer')
customer: Customer;
@Runnable()
async process() {
this.status = 'processing';
// Runnable entities can execute long-running workflows
await this.fulfillment.process(this);
this.status = 'shipped';
}
}