workflows

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AddressInstructions = addressInstructionsBeforeConfirmation + addressConfirmationInstruction + "\n" + addressInstructionsAfterConfirmation
View Source
const CardNumberInstructions = `` /* 692-byte string literal not displayed */
View Source
const CreditCardInstructions = `` /* 186-byte string literal not displayed */
View Source
const EmailInstructions = emailInstructionsBeforeConfirmation + emailConfirmationInstruction + "\n" + emailInstructionsAfterConfirmation
View Source
const ExpirationDateInstructions = `` /* 735-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 in grouped digits or with an optional leading plus.\n" +
	"Normalize common spoken patterns silently: convert spoken digits to numeric form, remove filler words, strip dashes, spaces, parentheses, and dots, and recognize plus at the start as the international prefix.\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" +
	"Never repeat the phone number back to the user as a single block of digits. Read it back in groups.\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 = `` /* 710-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.

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

Start by giving them a summary of the conversation so far, and answer any questions they might have.

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

You are talking to the human agent now,
give a brief introduction of the conversation so far, and ask if they want to connect to the caller.`

Variables

This section is empty.

Functions

func ValidateDtmfNumDigits added in v0.0.15

func ValidateDtmfNumDigits(numDigits int) error

Types

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 {
	RequireConfirmation    bool
	RequireConfirmationSet bool
	Instructions           *beta.InstructionParts
}

type GetAddressResult

type GetAddressResult struct {
	Address string
}

type GetAddressTask

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

func NewGetAddressTask

func NewGetAddressTask(opts GetAddressOptions) *GetAddressTask

func (*GetAddressTask) OnEnter

func (t *GetAddressTask) OnEnter()

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
	// contains filtered or unexported fields
}

func NewGetCardNumberTask added in v0.0.15

func NewGetCardNumberTask(requireConfirmation ...bool) *GetCardNumberTask

func (*GetCardNumberTask) OnEnter added in v0.0.15

func (t *GetCardNumberTask) OnEnter()

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
}

func NewGetCreditCardTask added in v0.0.15

func NewGetCreditCardTask(requireConfirmation ...bool) *GetCreditCardTask

func (*GetCreditCardTask) OnEnter added in v0.0.15

func (t *GetCreditCardTask) OnEnter()

type GetDOBOptions added in v0.0.15

type GetDOBOptions struct {
	ExtraInstructions      string
	IncludeTime            bool
	RequireConfirmation    bool
	RequireConfirmationSet bool
}

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
	// 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
	DtmfStopEvent      beta.DtmfEvent
	ExtraInstructions  string
}

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 {
	RequireConfirmation    bool
	RequireConfirmationSet bool
	Instructions           *beta.InstructionParts
}

type GetEmailResult

type GetEmailResult struct {
	Email string
}

type GetEmailTask

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

func NewGetEmailTask

func NewGetEmailTask(opts GetEmailOptions) *GetEmailTask

func (*GetEmailTask) OnEnter

func (t *GetEmailTask) OnEnter()

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
	// contains filtered or unexported fields
}

func NewGetExpirationDateTask added in v0.0.15

func NewGetExpirationDateTask(requireConfirmation ...bool) *GetExpirationDateTask

func (*GetExpirationDateTask) OnEnter added in v0.0.15

func (t *GetExpirationDateTask) OnEnter()

type GetNameOptions added in v0.0.15

type GetNameOptions struct {
	FirstName              bool
	MiddleName             bool
	LastName               bool
	NameFormat             string
	VerifySpelling         bool
	ExtraInstructions      string
	RequireConfirmation    bool
	RequireConfirmationSet bool
}

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
	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 {
	ExtraInstructions      string
	RequireConfirmation    bool
	RequireConfirmationSet bool
}

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
	// 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 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
	// contains filtered or unexported fields
}

func NewGetSecurityCodeTask added in v0.0.15

func NewGetSecurityCodeTask(requireConfirmation ...bool) *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 TaskGroup

type TaskGroup struct {
	agent.AgentTask[*TaskGroupResult]
	SummarizeChatCtx bool
	ReturnExceptions bool
	VisitedTasks     map[string]struct{}
	RegisteredTasks  []FactoryInfo
	OnTaskCompleted  func(taskID string, result any) 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 {
	TargetPhone       string
	TrunkID           string
	SipConnection     *livekit.SIPOutboundConfig
	SipNumber         string
	HoldAudio         interface{}
	DisableHoldAudio  bool
	ChatContext       *llm.ChatContext
	ExtraInstructions string
	Instructions      *beta.InstructionParts
}

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
	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