workflows

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const AddressInstructions = addressInstructionsBeforeConfirmation + addressConfirmationInstruction + "\n" + addressInstructionsAfterConfirmation
View Source
const CardNumberInstructions = `` /* 726-byte string literal not displayed */
View Source
const CreditCardInstructions = "*none*"
View Source
const EmailInstructions = emailInstructionsBeforeConfirmation + emailConfirmationInstruction + "\n" + emailInstructionsAfterConfirmation
View Source
const ExpirationDateInstructions = `` /* 779-byte string literal not displayed */
View Source
const PhoneNumberInstructions = "You are only a single step in a broader system, responsible solely for capturing a phone number.\n" +
	"Handle input as noisy voice transcription. Expect that users will say phone numbers aloud with formats like:\n" +
	"- '555 123 4567'\n" +
	"- 'five five five, one two three, four five six seven'\n" +
	"- '+1 555 123 4567'\n" +
	"- 'area code 555, 123 4567'\n" +
	"- '555-123-4567'\n" +
	"Normalize common spoken patterns silently:\n" +
	"- Convert spoken digits to their numeric form: 'five' → 5, 'zero' → 0, 'oh' → 0.\n" +
	"- Remove filler words, pauses, and hesitations.\n" +
	"- Strip dashes, spaces, parentheses, and dots from the number.\n" +
	"- Recognize 'plus' at the start as the international prefix `+`.\n" +
	"- Recognize 'area code' as a prefix for the area code digits.\n" +
	"Don't mention corrections. Treat inputs as possibly imperfect but fix them silently.\n" +
	"Call `update_phone_number` at the first opportunity whenever you form a new hypothesis about the phone number. (before asking any questions or providing any answers.)\n" +
	"Don't invent phone numbers, stick strictly to what the user said.\n" +
	phoneNumberConfirmationInstruction + "\n" +
	"If the number is unclear or invalid, or it takes too much back-and-forth, prompt for it in parts: first the area code, then the remaining digits.\n" +
	"Ask the user to confirm the updated phone number without repeating it back.\n" +
	"Ignore unrelated input and avoid going off-topic. Do not generate markdown, greetings, or unnecessary commentary.\n" +
	"Avoid verbosity by not sharing example phone numbers or formats unless prompted to do so. Do not deviate from the goal of collecting the user's phone number.\n" +
	"Always explicitly invoke a tool when applicable. Do not simulate tool usage, no real action is taken unless the tool is explicitly called."
View Source
const SecurityCodeInstructions = `` /* 711-byte string literal not displayed */
View Source
const WarmTransferBaseInstructions = warmTransferPersona + `
# Context

In the conversation, user refers to the human agent, caller refers to the person who's transcript is included.
Remember, you are not speaking to the caller right now, you are speaking to the human agent.

## Conversation history with caller
%s
## End of conversation history with caller

Once the human agent has confirmed, you should call the tool ` + "`connect_to_caller`" + ` to connect them to the caller.

You are talking to the human agent now, start by giving them a summary of the conversation so far, and answer any questions they might have.`

Variables

This section is empty.

Functions

func ValidateDtmfNumDigits added in v0.0.15

func ValidateDtmfNumDigits(numDigits int) error

Types

type AgentOptions added in v0.1.8

type AgentOptions struct {
	TurnDetection      *agent.TurnDetectionMode
	STT                stt.STT
	VAD                vad.VAD
	LLM                llm.LLM
	RealtimeModel      llm.RealtimeModel
	TTS                tts.TTS
	AllowInterruptions *bool
}

type CardCaptureDeclinedError added in v0.0.15

type CardCaptureDeclinedError struct {
	Reason string
}

func (*CardCaptureDeclinedError) Error added in v0.0.15

func (e *CardCaptureDeclinedError) Error() string

type CardCollectionRestartError added in v0.0.15

type CardCollectionRestartError struct {
	Reason string
}

func (*CardCollectionRestartError) Error added in v0.0.15

type FactoryInfo

type FactoryInfo struct {
	ID          string
	Description string
	TaskFactory func() agent.AgentInterface
}

type GetAddressOptions added in v0.0.15

type GetAddressOptions struct {
	AgentOptions
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	Instructions           *beta.InstructionParts
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetAddressResult

type GetAddressResult struct {
	Address string
}

type GetAddressTask

type GetAddressTask struct {
	agent.AgentTask[*GetAddressResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	// contains filtered or unexported fields
}

func NewGetAddressTask

func NewGetAddressTask(opts GetAddressOptions) *GetAddressTask

func (*GetAddressTask) OnEnter

func (t *GetAddressTask) OnEnter()

type GetCardNumberOptions added in v0.1.8

type GetCardNumberOptions struct {
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	ChatContext            *llm.ChatContext
}

type GetCardNumberResult added in v0.0.15

type GetCardNumberResult struct {
	Issuer     string
	CardNumber string
}

type GetCardNumberTask added in v0.0.15

type GetCardNumberTask struct {
	agent.AgentTask[*GetCardNumberResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	// contains filtered or unexported fields
}

func NewGetCardNumberTask added in v0.0.15

func NewGetCardNumberTask(requireConfirmation ...bool) *GetCardNumberTask

func NewGetCardNumberTaskWithOptions added in v0.1.8

func NewGetCardNumberTaskWithOptions(opts GetCardNumberOptions) *GetCardNumberTask

func (*GetCardNumberTask) OnEnter added in v0.0.15

func (t *GetCardNumberTask) OnEnter()

type GetCreditCardOptions added in v0.1.8

type GetCreditCardOptions struct {
	AgentOptions
	RequireConfirmation    bool
	RequireConfirmationSet bool
	ExtraInstructions      string
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetCreditCardResult added in v0.0.15

type GetCreditCardResult struct {
	CardholderName string
	Issuer         string
	CardNumber     string
	SecurityCode   string
	ExpirationDate string
}

type GetCreditCardTask added in v0.0.15

type GetCreditCardTask struct {
	agent.AgentTask[*GetCreditCardResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	ExtraInstructions      string
}

func NewGetCreditCardTask added in v0.0.15

func NewGetCreditCardTask(requireConfirmation ...bool) *GetCreditCardTask

func NewGetCreditCardTaskWithOptions added in v0.1.8

func NewGetCreditCardTaskWithOptions(opts GetCreditCardOptions) *GetCreditCardTask

func (*GetCreditCardTask) OnEnter added in v0.0.15

func (t *GetCreditCardTask) OnEnter()

type GetDOBOptions added in v0.0.15

type GetDOBOptions struct {
	AgentOptions
	ExtraInstructions      string
	IncludeTime            bool
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetDOBResult added in v0.0.15

type GetDOBResult struct {
	DateOfBirth time.Time
	TimeOfBirth *time.Time
}

type GetDOBTask added in v0.0.15

type GetDOBTask struct {
	agent.AgentTask[*GetDOBResult]
	ExtraInstructions      string
	IncludeTime            bool
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	// contains filtered or unexported fields
}

func NewGetDOBTask added in v0.0.15

func NewGetDOBTask(opts GetDOBOptions) *GetDOBTask

func (*GetDOBTask) OnEnter added in v0.0.15

func (t *GetDOBTask) OnEnter()

type GetDtmfOptions added in v0.0.15

type GetDtmfOptions struct {
	NumDigits           int
	AskForConfirmation  bool
	DtmfInputTimeout    time.Duration
	DtmfInputTimeoutSet bool
	DtmfStopEvent       beta.DtmfEvent
	ExtraInstructions   string
	ChatContext         *llm.ChatContext
}

type GetDtmfResult

type GetDtmfResult struct {
	UserInput string
}

type GetDtmfTask

type GetDtmfTask struct {
	agent.AgentTask[*GetDtmfResult]
	NumDigits          int
	AskForConfirmation bool
	DtmfInputTimeout   time.Duration
	DtmfStopEvent      beta.DtmfEvent
	// contains filtered or unexported fields
}

func NewGetDtmfTask

func NewGetDtmfTask(numDigits int, askConfirmation bool) (*GetDtmfTask, error)

func NewGetDtmfTaskWithOptions added in v0.0.15

func NewGetDtmfTaskWithOptions(opts GetDtmfOptions) (*GetDtmfTask, error)

func (*GetDtmfTask) OnEnter

func (t *GetDtmfTask) OnEnter()

func (*GetDtmfTask) OnExit

func (t *GetDtmfTask) OnExit()

type GetEmailOptions added in v0.0.15

type GetEmailOptions struct {
	AgentOptions
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	Instructions           *beta.InstructionParts
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetEmailResult

type GetEmailResult struct {
	Email string
}

type GetEmailTask

type GetEmailTask struct {
	agent.AgentTask[*GetEmailResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	// contains filtered or unexported fields
}

func NewGetEmailTask

func NewGetEmailTask(opts GetEmailOptions) *GetEmailTask

func (*GetEmailTask) OnEnter

func (t *GetEmailTask) OnEnter()

type GetExpirationDateOptions added in v0.1.8

type GetExpirationDateOptions struct {
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	ChatContext            *llm.ChatContext
}

type GetExpirationDateResult added in v0.0.15

type GetExpirationDateResult struct {
	Date string
}

type GetExpirationDateTask added in v0.0.15

type GetExpirationDateTask struct {
	agent.AgentTask[*GetExpirationDateResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	// contains filtered or unexported fields
}

func NewGetExpirationDateTask added in v0.0.15

func NewGetExpirationDateTask(requireConfirmation ...bool) *GetExpirationDateTask

func NewGetExpirationDateTaskWithOptions added in v0.1.8

func NewGetExpirationDateTaskWithOptions(opts GetExpirationDateOptions) *GetExpirationDateTask

func (*GetExpirationDateTask) OnEnter added in v0.0.15

func (t *GetExpirationDateTask) OnEnter()

type GetNameOptions added in v0.0.15

type GetNameOptions struct {
	AgentOptions
	FirstName              bool
	MiddleName             bool
	LastName               bool
	NamePartsSet           bool
	NameFormat             string
	VerifySpelling         bool
	ExtraInstructions      string
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetNameResult added in v0.0.15

type GetNameResult struct {
	FirstName  string
	MiddleName string
	LastName   string
}

type GetNameTask added in v0.0.15

type GetNameTask struct {
	agent.AgentTask[*GetNameResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	CollectFirstName       bool
	CollectMiddleName      bool
	CollectLastName        bool
	VerifySpelling         bool
	// contains filtered or unexported fields
}

func NewGetNameTask added in v0.0.15

func NewGetNameTask(opts GetNameOptions) *GetNameTask

func (*GetNameTask) OnEnter added in v0.0.15

func (t *GetNameTask) OnEnter()

type GetPhoneNumberOptions added in v0.0.15

type GetPhoneNumberOptions struct {
	AgentOptions
	ExtraInstructions      string
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ChatContext            *llm.ChatContext
	Tools                  []llm.Tool
}

type GetPhoneNumberResult added in v0.0.15

type GetPhoneNumberResult struct {
	PhoneNumber string
}

type GetPhoneNumberTask added in v0.0.15

type GetPhoneNumberTask struct {
	agent.AgentTask[*GetPhoneNumberResult]
	ExtraInstructions      string
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	// contains filtered or unexported fields
}

func NewGetPhoneNumberTask added in v0.0.15

func NewGetPhoneNumberTask(opts GetPhoneNumberOptions) *GetPhoneNumberTask

func (*GetPhoneNumberTask) OnEnter added in v0.0.15

func (t *GetPhoneNumberTask) OnEnter()

type GetSecurityCodeOptions added in v0.1.8

type GetSecurityCodeOptions struct {
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	ChatContext            *llm.ChatContext
}

type GetSecurityCodeResult added in v0.0.15

type GetSecurityCodeResult struct {
	SecurityCode string
}

type GetSecurityCodeTask added in v0.0.15

type GetSecurityCodeTask struct {
	agent.AgentTask[*GetSecurityCodeResult]
	RequireConfirmation    bool
	RequireConfirmationSet bool
	RequireExplicitAsk     bool
	ExtraInstructions      string
	// contains filtered or unexported fields
}

func NewGetSecurityCodeTask added in v0.0.15

func NewGetSecurityCodeTask(requireConfirmation ...bool) *GetSecurityCodeTask

func NewGetSecurityCodeTaskWithOptions added in v0.1.8

func NewGetSecurityCodeTaskWithOptions(opts GetSecurityCodeOptions) *GetSecurityCodeTask

func (*GetSecurityCodeTask) OnEnter added in v0.0.15

func (t *GetSecurityCodeTask) OnEnter()

type OutOfScopeError

type OutOfScopeError struct {
	TargetTaskIDs []string
}

func (*OutOfScopeError) Error

func (e *OutOfScopeError) Error() string

type TaskCompletedEvent added in v0.1.8

type TaskCompletedEvent struct {
	AgentTask agent.AgentInterface
	TaskID    string
	Result    any
}

type TaskGroup

type TaskGroup struct {
	agent.AgentTask[*TaskGroupResult]
	SummarizeChatCtx     bool
	ReturnExceptions     bool
	VisitedTasks         map[string]struct{}
	RegisteredTasks      []FactoryInfo
	OnTaskCompleted      func(taskID string, result any) error
	OnTaskCompletedEvent func(TaskCompletedEvent) error
	// contains filtered or unexported fields
}

func NewTaskGroup

func NewTaskGroup(summarize bool, returnExceptions bool) *TaskGroup

func (*TaskGroup) Add

func (g *TaskGroup) Add(id, description string, factory func() agent.AgentInterface) *TaskGroup

func (*TaskGroup) OnEnter

func (g *TaskGroup) OnEnter()

type TaskGroupResult

type TaskGroupResult struct {
	TaskResults map[string]any
}

type WarmTransferOptions added in v0.0.15

type WarmTransferOptions struct {
	AgentOptions
	TargetPhone       string
	TargetPhoneNumber string
	TrunkID           string
	TrunkIDSet        bool
	SipConnection     *livekit.SIPOutboundConfig
	SipNumber         string
	SipNumberSet      bool
	SipHeaders        map[string]string
	Dtmf              string
	RingingTimeout    time.Duration
	RingingTimeoutSet bool
	HoldAudio         interface{}
	DisableHoldAudio  bool
	ChatContext       *llm.ChatContext
	ExtraInstructions string
	Instructions      *beta.InstructionParts
	Tools             []llm.Tool
}

type WarmTransferResult

type WarmTransferResult struct {
	HumanAgentIdentity string
}

type WarmTransferTask

type WarmTransferTask struct {
	agent.AgentTask[*WarmTransferResult]
	TargetPhoneNumber string
	SipTrunkID        string
	SipConnection     *livekit.SIPOutboundConfig
	SipNumber         string
	SipHeaders        map[string]string
	Dtmf              string
	RingingTimeout    time.Duration
	RingingTimeoutSet bool
	HoldAudio         interface{}
	// contains filtered or unexported fields
}

func NewWarmTransferTask

func NewWarmTransferTask(targetPhone string, trunkId string, chatCtx *llm.ChatContext, extraInstructions string) (*WarmTransferTask, error)

func NewWarmTransferTaskWithOptions added in v0.0.15

func NewWarmTransferTaskWithOptions(opts WarmTransferOptions) (*WarmTransferTask, error)

func (*WarmTransferTask) ConnectToCaller

func (t *WarmTransferTask) ConnectToCaller() error

func (*WarmTransferTask) OnEnter

func (t *WarmTransferTask) OnEnter()

func (*WarmTransferTask) OnExit

func (t *WarmTransferTask) OnExit()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL