Skip to content

Class: AgentDefinitionBuilder

Builds an agent definition. Use newAgent to create a builder.

Extends

  • BaseDefinitionBuilder

Constructors

Constructor

new AgentDefinitionBuilder(): AgentDefinitionBuilder

Creates an agent builder. Use newAgent instead of calling this constructor directly.

Returns

AgentDefinitionBuilder

Overrides

BaseDefinitionBuilder.constructor

Properties

agent

readonly agent: object

See ComponentVersionDefinition.agent. Set via setInstructions and setTools.

instructions?

readonly optional instructions: string

Instructions guide what the agent does. Required for all agents.

tools?

readonly optional tools: readonly ({ type: CodaDocsAndTables; } | { type: MailAndCalendar; } | { allowedDomains?: readonly string[]; type: WebSearch; } | { formulas?: readonly object[]; mcpTools?: readonly object[]; packId: number; type: Pack; })[]

The products and sources this agent can use, such as Docs, Mail, web search, or connectors. If this list is empty, none are configured. Go's built-in platform features remain available to the LLM.


defaultRoutines?

readonly optional defaultRoutines: readonly object[]

See ComponentVersionDefinition.defaultRoutines. Set via addDefaultRoutine. Mail triggers here name their event mailEventType, as in an uploaded pack.


suggestedPrompts?

readonly optional suggestedPrompts: readonly object[]

See ComponentVersionDefinition.suggestedPrompts. Set via addSuggestedPrompt.


version?

optional version: string

See ComponentVersionDefinition.version.

Inherited from

BaseDefinitionBuilder.version

Methods

addDefaultRoutine()

addDefaultRoutine(routine): this

Adds a routine that runs when its trigger fires.

Example

agent.addDefaultRoutine({
  name: 'Daily brief',
  instructions: 'Summarize overnight changes. Include source links.',
  trigger: {
    kind: sdk.DefaultTriggerKind.Schedule,
    rruleString: 'DTSTART;TZID=America/New_York:20261012T090000\nRRULE:FREQ=DAILY',
  },
});

Parameters

Parameter Type
routine AgentRoutineDefinition

Returns

this


addSuggestedPrompt()

addSuggestedPrompt(prompt): this

Adds a starter prompt that shows as a button when someone opens this agent in chat. An agent can have up to 3.

Example

agent.addSuggestedPrompt({
  name: 'ticketStatus',
  displayName: 'Check ticket status',
  prompt: 'Show me the status of all open support tickets',
});

Parameters

Parameter Type
prompt SuggestedPrompt

Returns

this


setInstructions()

setInstructions(instructions): this

Sets this agent's instructions.

Example

agent.setInstructions('You help a team run async standups. Keep replies short.');

Parameters

Parameter Type
instructions string

Returns

this


setTools()

setTools(__namedParameters): this

Choose which products and sources your agent can use, such as Docs, Mail, web search, or connectors. Go's built-in platform features are available automatically, so you don't need to add them here.

Example

agent.setTools({docs: true, mail: true, webSearch: {allowedDomains: ['docs.example.com']}});
agent.setTools({connectors: [{connectorId: 1234, formulas: [{formulaName: 'CreateTask'}]}]});
agent.setTools({connectors: [{connectorId: 5678, mcpTools: [{toolName: 'search_issues'}]}]});

Parameters

Parameter Type
__namedParameters AgentToolsDef

Returns

this


setVersion()

setVersion(version): this

Sets the semantic version of this definition version, e.g. '1.2.3'.

This is optional, and you only need to provide a version if you are manually doing semantic versioning, or using the CLI. If using the web editor, you can omit this and the web editor will automatically provide an appropriate semantic version each time you build a version.

Example

builder.setVersion('1.2.3');

Parameters

Parameter Type
version string

Returns

this

Inherited from

BaseDefinitionBuilder.setVersion