For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
      • ContextBuilder
        • addContext
        • Context
        • createSimpleContext
        • GatherInfo & GatherQuestion
        • getCompletionAction
        • getContext
        • getGatherInfo
        • getQuestions
        • getStepOrder
        • getSteps
        • getValidContexts
        • reset
        • Step
          • addBullets
          • addGatherQuestion
          • addSection
          • clearSections
          • setEnd
          • setFunctions
          • setGatherInfo
          • setResetConsolidate
          • setResetFullReset
          • setResetSystemPrompt
          • setResetUserPrompt
          • setSkipToNextStep
          • setSkipUserTurn
          • setStepCriteria
          • setText
          • setValidContexts
          • setValidSteps
        • toDict
        • validate
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsContextBuilderStep

setFunctions

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

setGatherInfo

Next
Built with

Set which non-internal functions are callable while this step is active. Restricting functions per step prevents the AI from calling irrelevant tools and keeps the per-step active set small — LLM tool selection accuracy degrades noticeably past ~7–8 simultaneously-active tools per call.

Step toolsets inherit from the previous step. If you do not call setFunctions() on a step, it inherits whichever function set was active on the previous step (or the previous context’s last step). The server-side runtime only resets the active set when a step explicitly declares its functions field. This is the most common source of bugs in multi-step agents — forgetting setFunctions() on a later step lets the previous step’s tools leak through. Best practice: call setFunctions() explicitly on every step that should have a different toolset than the previous one.

Internal functions (startup_hook, hangup_hook, gather_submit, etc.) are always protected and cannot be deactivated by this whitelist. The native navigation tools next_step and change_context are injected automatically when setValidSteps() / setValidContexts() is set; they are not affected by this list and do not need to appear in it.

Parameters

functions
string | string[]Required

One of:

  • string[] — whitelist of function names allowed in this step. Functions not in the list become inactive.
  • [] — explicit disable-all (no user functions callable).
  • "none" — synonym for [], same effect.

Returns

Step — Self for method chaining.

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5const greet = ctx.addStep('greet');
6greet.setText('Welcome the caller.');
7greet.setFunctions('none');
8const verify = ctx.addStep('verify');
9verify.setText('Verify the caller\'s identity.');
10verify.setFunctions(['lookup_account', 'verify_identity']);