tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tools contains the beta LiveKit agent tools.

Index

Constants

View Source
const DefaultDTMFPublishDelay = 300 * time.Millisecond
View Source
const DefaultEndCallReplyTimeout = 5 * time.Second
View Source
const END_CALL_DESCRIPTION = EndCallDescription

END_CALL_DESCRIPTION is the deprecated TypeScript-style constant alias.

View Source
const EndCallDescription = `` /* 395-byte string literal not displayed */

Variables

Functions

func CreateEndCallTool

func CreateEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)

func DTMFEventCode

func DTMFEventCode(event DTMFEvent) (uint32, error)

func MustEndCallTool

func MustEndCallTool[UserData any](options EndCallToolOptions[UserData]) *llm.Toolset

func NewEndCallTool

func NewEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)

NewEndCallTool is the Go constructor alias for CreateEndCallTool.

func NewSendDtmfEventsTool

func NewSendDtmfEventsTool(options SendDTMFEventsToolOptions) (*llm.FunctionTool[SendDTMFEventsInput, string], error)

NewSendDtmfEventsTool is deprecated; prefer NewSendDTMFEventsTool.

func SendDTMFEvents

func SendDTMFEvents(ctx context.Context, publisher DTMFPublisher, events []DTMFEvent, options SendDTMFOptions) string

SendDTMFEvents publishes events sequentially and preserves agents-js's exact human-readable tool output contract. Failures are returned in-band so the LLM can report which digit failed.

func SendDtmfEvents

func SendDtmfEvents(ctx context.Context, publisher DTMFPublisher, events []DtmfEvent, options SendDTMFOptions) string

SendDtmfEvents is deprecated; prefer SendDTMFEvents.

Types

type DTMFEvent

type DTMFEvent string
const (
	DTMF0     DTMFEvent = "0"
	DTMF1     DTMFEvent = "1"
	DTMF2     DTMFEvent = "2"
	DTMF3     DTMFEvent = "3"
	DTMF4     DTMFEvent = "4"
	DTMF5     DTMFEvent = "5"
	DTMF6     DTMFEvent = "6"
	DTMF7     DTMFEvent = "7"
	DTMF8     DTMFEvent = "8"
	DTMF9     DTMFEvent = "9"
	DTMFStar  DTMFEvent = "*"
	DTMFPound DTMFEvent = "#"
	DTMFA     DTMFEvent = "A"
	DTMFB     DTMFEvent = "B"
	DTMFC     DTMFEvent = "C"
	DTMFD     DTMFEvent = "D"
)

type DTMFPublisher

type DTMFPublisher interface {
	PublishDTMF(context.Context, uint32, string) error
}

func AdaptDTMFJobContext

func AdaptDTMFJobContext[UserData any](job *agents.JobContext[UserData]) DTMFPublisher

func RoomDTMFPublisher

func RoomDTMFPublisher(room *lksdk.Room) DTMFPublisher

type DtmfEvent

type DtmfEvent = DTMFEvent

DtmfEvent is the deprecated initialism alias retained for agents-js beta migrations. Prefer DTMFEvent.

type EndCallJob

type EndCallJob interface {
	AddShutdownCallback(func(context.Context, string) error) error
	DeleteRoom(context.Context, string) error
	Shutdown(string)
}

func AdaptEndCallJobContext

func AdaptEndCallJobContext[UserData any](job *agents.JobContext[UserData]) EndCallJob

type EndCallSession

type EndCallSession interface {
	Subscribe(voice.EventSubscriptionOptions) (*voice.EventSubscription, error)
	AgentState() voice.AgentState
	Close(context.Context, ...voice.CloseOptions) error
}

type EndCallToolCalledEvent

type EndCallToolCalledEvent[UserData any] struct {
	Context   *llm.RunContext
	Arguments struct{}
}

type EndCallToolCompletedEvent

type EndCallToolCompletedEvent[UserData any] struct {
	Context *llm.RunContext
	Output  *EndCallToolOutput
}

type EndCallToolOptions

type EndCallToolOptions[UserData any] struct {
	ExtraDescription string
	// Nil preserves the agents-js default (true).
	DeleteRoom *bool
	// Zero inherits "say goodbye to the user". Disable maps to null.
	EndInstructions agents.Override[string]
	IgnoreOnEnter   bool
	OnToolCalled    func(context.Context, EndCallToolCalledEvent[UserData]) error
	OnToolCompleted func(context.Context, EndCallToolCompletedEvent[UserData]) error
	Job             EndCallJob
	ReplyTimeout    time.Duration
	ShutdownTimeout time.Duration
	OnError         func(error)
}

type EndCallToolOutput

type EndCallToolOutput struct{ Type, Value string }

type LocalParticipantDTMFPublisher

type LocalParticipantDTMFPublisher struct{ Participant *lksdk.LocalParticipant }

LocalParticipantDTMFPublisher adapts server-sdk-go's typed SIP DTMF data packet. PublishDataPacket is synchronous but not context-aware; the adapter checks cancellation immediately before the call.

func (LocalParticipantDTMFPublisher) PublishDTMF

func (p LocalParticipantDTMFPublisher) PublishDTMF(ctx context.Context, code uint32, digit string) error

type SendDTMFEventsInput

type SendDTMFEventsInput struct {
	Events []DTMFEvent `json:"events"`
}

type SendDTMFEventsToolOptions

type SendDTMFEventsToolOptions struct {
	Publisher        DTMFPublisher
	ResolvePublisher func(llm.ToolOptions) (DTMFPublisher, error)
	PublishDelay     time.Duration
}

type SendDTMFOptions

type SendDTMFOptions struct{ PublishDelay time.Duration }

Jump to

Keyboard shortcuts

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