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

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';
  }
}

Learn More