llmworker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: BSD-2-Clause Imports: 22 Imported by: 0 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 llmworker is a pipeline worker built around a language model, with the tool handling that makes one usable from the bus.

A worker's tools run while the pipeline that called them is still running, and what a tool does often needs to reach that pipeline: appending to the conversation, ending the session, handing over to another worker. Doing any of it while the call is still in flight puts it out of order with the result the model is waiting for. This package holds it back until the call is done.

Index

Constants

View Source
const (
	// AttachJobName is the job that attaches a frontend to a BackendWorker.
	AttachJobName = "attach"
	// MessageJobName is the job that puts a message to an attached
	// BackendWorker.
	MessageJobName = "message"
)

The names of the jobs a BackendWorker answers.

View Source
const (
	// OutputUpdateType is the type of an update that carries a BackendOutput.
	OutputUpdateType = "output"
	// ToolCallUpdateType is the type of an update that carries a
	// BackendToolCall.
	ToolCallUpdateType = "tool_call"
	// AttachedUpdateType is the type of the update that opens an attach job's
	// stream.
	AttachedUpdateType = "attached"
	// IdleUpdateType is the type of the update that says the backend has
	// nothing left to do.
	IdleUpdateType = "idle"
	// ErrorUpdateType is the type of the update that says the backend could
	// not go on.
	ErrorUpdateType = "error"
)

The types of the updates an attach job's stream carries.

View Source
const BackendPairingInstruction = "You are the backend of a voice assistant. The assistant talks with " +
	"the user and sends you requests: the conversation it is having, or a request it worded for you. " +
	"Do the parts that need your tools or careful reasoning; the assistant handles the rest of the " +
	"conversation itself, such as small talk, jokes and stories, so leave those to it.\n\n" +
	"WHAT THE USER HEARS: Begin a message with " + SpokenMark + " and the whole of it is told to " +
	"the user, in the assistant's own words, tool calls or not. Anything you write without " +
	"the mark is not told to the user: the assistant keeps it as notes on your work, and " +
	"draws on them only if the user asks how the work is going. " +
	"Mark a message to give a result, to ask a question you cannot proceed without, or for " +
	"news the user should have now. A result you do not mark is " +
	"lost: the message that gives it begins with " + SpokenMark + ". Never say again what you " +
	"have already marked, and never mark that you have stopped or that there is nothing to " +
	"do: the assistant has already told the user. Write a marked message as plain spoken " +
	"sentences the assistant can say as they are: no headings, lists, Markdown or raw " +
	"JSON.\n\n" +
	"REQUESTS: A request may arrive while you are working on an earlier one. It may add " +
	"work, change it, or stop some or all of it: follow the latest, cancel the tools whose " +
	"results are no longer wanted, and do not repeat work already done. With several " +
	"requests in hand, do the newest first unless it depends on an earlier one, and give " +
	"each one's result as soon as you have it, not when everything is done."

BackendPairingInstruction is how the backend's model works with the assistant, appended to its system instruction: who it is, which of what it writes the user hears, and how it takes requests. The backend's own system instruction says what it does; this says how what it writes reaches the user. BackendConfig.PairingInstruction replaces it.

View Source
const ExplicitRequestInstruction = "If this request asks for something, tell the user the result as " +
	"soon as you have it, before going on with other work, in a message that begins with " +
	SpokenMark + ". If it only stops or changes work already under way, tell them nothing: the " +
	"assistant already has."

ExplicitRequestInstruction is appended to a request the frontend worded itself, so the backend tells the user its result on its own rather than with whatever else it is doing.

View Source
const SpokenMark = ">>"

SpokenMark is the mark the backend's model puts at the start of a message it wants the user told. The message is sent with PrefersSpoken set, mark stripped; a message without it is a note. Strict prompt, flexible parsing: the model is told to put the mark first, but sometimes writes a note paragraph and then a marked one, so a mark at the start of a later line splits the message, a note before it and a spoken message from it on, rather than losing the result.

View Source
const TranscriptRequestInstruction = "Act on the user's most recent request in the conversation above. " +
	"If it asks for something, tell the user the result as soon as you have it, before going on with " +
	"other work, in a message that begins with " + SpokenMark + ". If it only stops or changes work " +
	"already under way, tell them nothing: the assistant already has."

TranscriptRequestInstruction is what RenderTranscriptRequest tells the backend to do with a transcript.

Variables

View Source
var ErrRoleDeclined = errors.New("the LLM service declines the backend role")

ErrRoleDeclined is reported by NewBackend when the LLM service cannot be the backend; the error names the service's own reason.

Functions

func RenderExplicitRequest added in v0.3.0

func RenderExplicitRequest(request, instruction string) string

RenderExplicitRequest renders a request the frontend worded itself, with what the backend should do with it after. An empty instruction uses ExplicitRequestInstruction.

func RenderTranscriptRequest added in v0.3.0

func RenderTranscriptRequest(conversation []frames.Message, instruction string, first bool) string

RenderTranscriptRequest renders a conversation as a labeled transcript for the backend to act on.

Flattening the conversation into one message keeps the two conversations apart: the backend's context holds only what the backend itself said as assistant messages, so it never mistakes the frontend's speech for its own.

Only user and assistant text crosses: tool results, other content and messages in a service's own format are skipped, and say so at debug level. Carrying more is a question of how to render it.

instruction is what the backend should do with the transcript, placed after it; empty uses TranscriptRequestInstruction. first reports whether this is the backend's first request in the conversation, which decides how the transcript is introduced: as the conversation so far, or as what has been said since the previous delegation.

Types

type ActivationArgs

type ActivationArgs struct {
	workers.BaseActivationArgs
	// Messages are appended to the conversation when the worker activates.
	Messages []map[string]any
	// RunLLM says whether the model answers them. Nil answers, which is what a
	// caller sending messages almost always means.
	RunLLM *bool
}

ActivationArgs are what an LLM worker understands when it is activated: the messages to put into the conversation, and whether to answer them.

func ActivationArgsFrom

func ActivationArgsFrom(args map[string]any) ActivationArgs

ActivationArgsFrom reads what an LLM worker understands out of the arguments it was activated with, ignoring anything else in them.

func (ActivationArgs) ToMap

func (a ActivationArgs) ToMap() map[string]any

ToMap implements workers.ActivationArgs.

type BackendConfig added in v0.3.0

type BackendConfig struct {
	// Name is what other workers address this one by. Empty generates one;
	// give one when the backend runs in another process, where the frontend
	// addresses it by name.
	Name string
	// LLM is the backend LLM service.
	LLM BackendLLM
	// Context is the backend's conversation, typically carrying its tools. Nil
	// starts an empty one.
	Context *frames.LLMContext
	// Tools are tools the model may call, registered on the service as an LLM
	// worker registers them, beside any the context carries.
	Tools []frames.Tool
	// TransformOutput is called with each BackendOutput the model produces
	// before it is sent, to adjust its text or whether the user may hear it, or
	// to return nil and send nothing. Outputs the app sends itself are not
	// passed through it unless SendOutput asks.
	TransformOutput BackendOutputTransform
	// PairingInstruction is how the model works with the assistant, appended
	// to the LLM's system instruction: BackendPairingInstruction when empty. One
	// of its own has to say what that one says: that the assistant sends it
	// requests, that the user hears what it marks with SpokenMark and nothing
	// else, and how to take requests that arrive while it works.
	PairingInstruction string
	// AggregatorOptions configure the aggregator pair the worker builds. The
	// user aggregator takes external turn strategies unless these choose
	// others: the backend has no audio, so the default strategies, and any model
	// they load, have nothing to do here.
	AggregatorOptions []aggregators.Option
	// WorkerConfig is the rest of the pipeline worker's configuration.
	WorkerConfig pipeline.WorkerConfig
}

BackendConfig configures a BackendWorker.

type BackendError added in v0.3.0

type BackendError struct {
	// Error is what went wrong.
	Error string
}

BackendError says the backend could not go on with what it was doing.

type BackendEvent added in v0.3.0

type BackendEvent interface {
	// contains filtered or unexported methods
}

BackendEvent is what a BackendSession yields: a BackendOutput, a BackendToolCall, a BackendIdle or a BackendError.

type BackendIdle added in v0.3.0

type BackendIdle struct{}

BackendIdle says the backend has nothing left to do: no run outstanding, no call in flight.

type BackendLLM added in v0.3.0

type BackendLLM interface {
	ToolRegistrar
	// Events is the registry the service's frame events are raised on.
	Events() *events.Registry
	// HasQueuedFrame reports whether a frame matching is waiting to be handled.
	HasQueuedFrame(match func(frames.Frame) bool) bool
	// AppendSystemInstruction adds text to the model's system instruction.
	AppendSystemInstruction(instruction string)
	// SetUseProviderThinkingDefault has a model with no thinking configured run
	// at its provider's default.
	SetUseProviderThinkingDefault(on bool)
	// CancelFunctionCalls cancels every function call in flight.
	CancelFunctionCalls(ctx context.Context, reason string) []frames.ToolCall
	llm.LLMWithBackendRoleObjector
}

BackendLLM is what a BackendWorker needs of the LLM service it runs. The LLM service base satisfies it.

type BackendOutput added in v0.3.0

type BackendOutput struct {
	// Text is the text the backend produced.
	Text string
	// IsThought reports whether this is a reasoning summary rather than a
	// response.
	IsThought bool
	// PrefersSpoken reports whether the backend would like the user to hear
	// this. It is a hint the frontend may follow or not. A literal leaves it
	// false; NewBackendOutput sets it, as an output the app sends is meant to be
	// heard unless it says otherwise.
	PrefersSpoken bool
}

BackendOutput is one piece of output from a backend, on its way to the frontend.

func BackendOutputFromPayload added in v0.3.0

func BackendOutputFromPayload(payload map[string]any) BackendOutput

BackendOutputFromPayload rebuilds an output from a job update payload.

A flag the payload omits is left to its default, so a sender that predates a flag does not decide its value: an output is spoken and not a thought unless the payload says otherwise. A flag it carries is coerced, since a payload can arrive from another process.

func NewBackendOutput added in v0.3.0

func NewBackendOutput(text string) BackendOutput

NewBackendOutput builds an output the backend would like the user to hear.

func (BackendOutput) ToPayload added in v0.3.0

func (o BackendOutput) ToPayload() map[string]any

ToPayload renders the output as a job update payload.

type BackendOutputTransform added in v0.3.0

type BackendOutputTransform func(ctx context.Context, output BackendOutput) (*BackendOutput, error)

BackendOutputTransform shapes one of the backend model's outputs before it is sent. It returns the output to send in its place, or nil to send nothing.

type BackendSession added in v0.3.0

type BackendSession struct {
	// contains filtered or unexported fields
}

BackendSession is a frontend's side of the attached contract: one backend worker, attached for the session's life.

Opening the session sends the attach job; closing it cancels the job, which stops the backend's work. In between, Next yields what the backend produces, and Send puts messages to it. The stream ends when the backend goes away, with an error if it failed.

session, err := llmworker.OpenBackendSession(ctx, worker, "backend", 30*time.Second)
if err != nil { … }
defer session.Close(ctx)
status, err := session.Send(ctx, request)
for {
    event, err := session.Next(ctx)
    if err != nil { break }
    …
}

func NewBackendSession added in v0.3.0

func NewBackendSession(requester jobcontext.Requester, backendName string, timeout time.Duration) *BackendSession

NewBackendSession builds a session with the named backend worker, not yet attached: Open attaches it. Send works on a session that is not attached, and is refused by a backend with no frontend attached.

requester is the worker attaching (for a pipeline processor, the pipeline worker it runs in). timeout bounds how long a message may take to be acknowledged, including the wait for the backend to become ready; zero waits as long as it takes. The attachment itself has no timeout.

func OpenBackendSession added in v0.3.0

func OpenBackendSession(
	ctx context.Context, requester jobcontext.Requester, backendName string, timeout time.Duration,
) (*BackendSession, error)

OpenBackendSession builds a session with the named backend worker and opens it. See NewBackendSession and Open.

func (*BackendSession) BackendName added in v0.3.0

func (s *BackendSession) BackendName() string

BackendName is the name of the backend worker.

func (*BackendSession) Capabilities added in v0.3.0

func (s *BackendSession) Capabilities() map[string]bool

Capabilities is what the backend said it can do, once its stream has opened.

func (*BackendSession) Close added in v0.3.0

func (s *BackendSession) Close(ctx context.Context)

Close detaches: it cancels the attach job, which stops the backend's work. The cancellation reaches the backend even when ctx has already ended, since a backend left working for a frontend that is gone is worse than one stopped late.

func (*BackendSession) Detached added in v0.3.0

func (s *BackendSession) Detached() bool

Detached reports whether the stream ended because this side let go of the backend (the session was closed, or the attaching worker stopped), as opposed to the backend going away.

func (*BackendSession) Next added in v0.3.0

Next returns the next thing the backend produced, waiting for it.

It returns io.EOF once the stream has ended without a failure: the session was closed (Detached then reports true) or the backend went away. It returns an error wrapping jobcontext.ErrJob, naming the backend's reason where it gave one, when the backend refused the attachment or failed, and ctx's error when ctx ends first. Updates of a type the session does not know are skipped.

func (*BackendSession) Open added in v0.3.0

func (s *BackendSession) Open(ctx context.Context) error

Open attaches the session: it sends the attach job, whose stream Next reads.

It returns once the backend has taken the attachment up, with the first update of its stream or by refusing it, so a message sent next finds it attached: every job is handled on a goroutine of its own, and one sent right behind the attachment could otherwise reach the backend first. The wait for that is bounded by the session's timeout, and a refusal is reported by Next.

func (*BackendSession) Send added in v0.3.0

func (s *BackendSession) Send(ctx context.Context, request string) (string, error)

Send puts a message to the backend, the text appended to its conversation, and returns what the backend was doing when it arrived: "idle" or "working". It reports an error wrapping jobcontext.ErrJob, naming the backend's reason, when the backend refused the message or did not answer in time.

type BackendToolCall added in v0.3.0

type BackendToolCall struct {
	// Phase is where the call has got to.
	Phase BackendToolCallPhase
	// FunctionName is the name of the function called.
	FunctionName string
	// ToolCallID identifies the call.
	ToolCallID string
	// Arguments is the raw JSON arguments passed to the function, once known.
	Arguments json.RawMessage
	// Result is the result, for the result phase.
	Result string
	// IsFinal reports, for the result phase, whether the result completes the
	// call rather than being one of a stream of intermediate results.
	IsFinal bool
}

BackendToolCall is one phase of a function call the backend made while working, on its way to the frontend.

The call ran in the backend's own pipeline; the frontend reports it to clients, as the ExternalFunctionCall frame ToFrame builds, and does nothing else with it.

func BackendToolCallFromPayload added in v0.3.0

func BackendToolCallFromPayload(payload map[string]any) BackendToolCall

BackendToolCallFromPayload rebuilds a call phase from a job update payload.

func (BackendToolCall) ToFrame added in v0.3.0

func (c BackendToolCall) ToFrame() frames.Frame

ToFrame builds the frame that reports this phase in the frontend's pipeline.

func (BackendToolCall) ToPayload added in v0.3.0

func (c BackendToolCall) ToPayload() map[string]any

ToPayload renders the call phase as a job update payload. The arguments travel as the JSON object they are, so a payload crossing a bus carries them as data rather than as encoded text.

type BackendToolCallPhase added in v0.3.0

type BackendToolCallPhase string

BackendToolCallPhase is where a function call the backend made has got to.

const (
	BackendToolCallStarted    BackendToolCallPhase = "started"
	BackendToolCallInProgress BackendToolCallPhase = "in_progress"
	BackendToolCallResult     BackendToolCallPhase = "result"
	BackendToolCallCanceled   BackendToolCallPhase = "cancelled" //nolint:misspell // the value on the wire
)

The phases of a backend function call, which mirror the pipeline's own function-call frames.

type BackendWorker added in v0.3.0

type BackendWorker struct {
	*ContextWorker
	// contains filtered or unexported fields
}

BackendWorker is a worker that runs an LLM service as the backend a frontend delegates to.

The worker owns the backend's conversation, a context plus the aggregator pair, so multi-step tool calling works as it does in any pipeline. A frontend attaches once, for as long as it lives, and from then on hears everything the backend produces; requests it sends are appended to that conversation as user messages and run the model. BackendSession is the caller side.

The worker's LLM does the reasoning its frontend hands off, so it runs at its provider's default thinking unless its configuration sets thinking (see llm.Base.SetUseProviderThinkingDefault).

Job contract:

  • attach: no payload. Its first update is {"type": "attached", "capabilities": {...}}; after that, a BackendOutput payload for each of the model's turns and reasoning summaries and each output the app sends with SendOutput, a BackendToolCall payload for each phase of each function call the backend makes, {"type": "idle"} when the backend has nothing left to do, and {"type": "error", "error": ...} when it could not go on. The job lives until the requester cancels it, which stops the backend's work. Refused while another frontend is attached.
  • message: {"request": string}, appended as a user message; answers at once with {"backend": "idle" | "working"}, what the backend was doing when the message arrived. A message that arrives mid-run is taken up after the current step, with everything that came before it in view.

The model decides what the user hears: a message it begins with SpokenMark asks to be spoken, whether or not the turn also calls tools, and the mark is stripped; anything else it writes, reasoning summaries included, is a note that the frontend keeps but does not speak. A mark at the start of a later line splits the message into a note and a spoken part, since the model sometimes writes it that way. The backend's own system instruction says what it does and, in plain words, what the user should be told; the pairing instruction the worker appends is the only place the mark is named. TransformOutput can change the flag, or the text, or drop the output.

func NewBackend added in v0.3.0

func NewBackend(cfg BackendConfig) (*BackendWorker, error)

NewBackend builds a backend worker. It reports an error when the LLM service declines the backend role.

func (*BackendWorker) BackendCapabilities added in v0.3.0

func (b *BackendWorker) BackendCapabilities() map[string]bool

BackendCapabilities is what an attached frontend can count on: all of it, for a backend that is an LLM.

func (*BackendWorker) OnJobCancelled added in v0.3.0

func (b *BackendWorker) OnJobCancelled(ctx context.Context, m *bus.JobCancelMessage)

OnJobCancelled stops the model when the frontend that was attached is gone.

The attach job's handler is already called off by the time this runs, and has let go of the attachment; the work in flight stops too, so none of it is reported after the frontend has let go of it.

func (*BackendWorker) SendOutput added in v0.3.0

func (b *BackendWorker) SendOutput(ctx context.Context, output BackendOutput, applyTransform bool)

SendOutput sends one output of the app's own to the frontend.

It reaches the frontend as the model's outputs do, but as given unless asked: TransformOutput is not applied to it unless applyTransform is set, so an app can silence the model's outputs with a transform that drops them and still send outputs of its own, such as from a tool the model calls to talk to the user. With no frontend attached there is nowhere for it to go, and it is dropped with a warning.

func (*BackendWorker) Working added in v0.3.0

func (b *BackendWorker) Working() bool

Working reports whether the backend has work in hand: a request or run outstanding, or a call in flight.

type Config

type Config struct {
	// Name is what other workers address this one by.
	Name string
	// LLM is the language model service the worker runs. The tools are
	// registered on it.
	LLM ToolRegistrar
	// Pipeline is the pipeline to run. Nil runs the model on its own, which is
	// what a worker doing nothing but answering needs.
	Pipeline processor.Processor
	// Tools are the tools the model may call. Each is registered on the service
	// with the call options it carries, wrapped so that what its handler queues
	// is held until the call finishes.
	Tools []frames.Tool
	// Active reports whether the worker starts active. Nil leaves it inactive,
	// because a worker with a model behind it is almost always started by
	// something else deciding it is time.
	Active *bool
	// Bridged names the bridges this worker's pipeline exchanges frames over.
	// Non-nil wraps the pipeline in bus edges.
	Bridged []string
	// DeferToolFrames says whether what a tool handler queues is held until
	// every call in flight has finished. Nil holds it, which is what keeps a
	// tool's own frames behind the result the model is waiting for.
	DeferToolFrames *bool
	// WorkerConfig is the rest of the pipeline worker's configuration. Name,
	// Active and Bridged are taken from the fields above.
	WorkerConfig pipeline.WorkerConfig
}

Config configures an LLM worker.

type ContextConfig

type ContextConfig struct {
	// Name is what other workers address this one by.
	Name string
	// LLM is the language model service the worker runs.
	LLM ToolRegistrar
	// Tools are the tools the model may call.
	Tools []frames.Tool
	// Active reports whether the worker starts active; nil leaves it inactive.
	Active *bool
	// Bridged names the bridges this worker's pipeline exchanges frames over.
	Bridged []string
	// DeferToolFrames says whether what a tool handler queues is held until the
	// calls in flight finish; nil holds it.
	DeferToolFrames *bool
	// Context is the conversation to run. Nil starts an empty one.
	Context *frames.LLMContext
	// AggregatorOptions configure the aggregator pair the worker builds.
	AggregatorOptions []aggregators.Option
	// WorkerConfig is the rest of the pipeline worker's configuration.
	WorkerConfig pipeline.WorkerConfig
}

ContextConfig configures a context worker. It is Config without the pipeline, which the worker builds itself around the conversation it owns.

type ContextWorker

type ContextWorker struct {
	*Worker
	// contains filtered or unexported fields
}

ContextWorker is an LLM worker that owns its conversation.

It is for a worker that tracks a conversation of its own rather than sharing the one a transport pipeline carries: the pipeline is built as user aggregator, model, assistant aggregator, so the worker keeps its own history without the caller wiring it up.

func NewContext

func NewContext(cfg ContextConfig) *ContextWorker

NewContext builds a worker that owns its conversation.

func (*ContextWorker) AssistantAggregator

func (c *ContextWorker) AssistantAggregator() *aggregators.AssistantAggregator

AssistantAggregator is the half that gathers what the bot said, and is where the events reporting a finished turn are raised.

func (*ContextWorker) Context

func (c *ContextWorker) Context() *frames.LLMContext

Context is the conversation this worker owns.

func (*ContextWorker) UserAggregator

func (c *ContextWorker) UserAggregator() *aggregators.UserAggregator

UserAggregator is the half that gathers what the user said.

type ToolRegistrar

type ToolRegistrar interface {
	processor.Processor
	RegisterFunction(name string, h llm.FunctionCallHandler, opts ...llm.RegisterOption)
}

ToolRegistrar is what an LLM worker needs of the service it runs: somewhere to register the tools. The LLM service base satisfies it.

type Worker

type Worker struct {
	*pipeline.Worker
	// contains filtered or unexported fields
}

Worker runs a language model as a worker on the bus, and holds back what its tools do until the calls that asked for it have finished.

A tool handler runs while the model is still waiting for its result. Anything the handler does to the pipeline in the meantime, appending to the conversation, ending the session, handing over to another worker, would land ahead of that result and put the turn out of order. What the handler queues is therefore held, and released once the last call in flight is done; ending and handing over wait for the same moment.

func New

func New(cfg Config) *Worker

New builds an LLM worker.

func (*Worker) ActivateWorker

func (w *Worker) ActivateWorker(ctx context.Context, name string, opts workers.ActivateOptions)

ActivateWorker hands over to another worker once the tool call asking for it is done, for the reason End waits.

func (*Worker) End

func (w *Worker) End(ctx context.Context, reason string)

End brings the session to a close once the tool call asking for it is done.

A tool that ends the session is still running when it asks, and ending the worker underneath it would leave the rest of that call to nobody. Deliver the call's result first, so what the model says about it is spoken before the session goes.

func (*Worker) LLM

func (w *Worker) LLM() ToolRegistrar

LLM is the service this worker runs.

func (*Worker) OnActivated

func (w *Worker) OnActivated(ctx context.Context, args map[string]any)

OnActivated advertises the tools and puts the activation's messages into the conversation.

func (*Worker) ProcessDeferredFrames

func (w *Worker) ProcessDeferredFrames(_ context.Context, held []deferredFrame) []deferredFrame

ProcessDeferredFrames is called with the frames held during a run of tool calls, just before they are queued, and returns the ones to queue. The default returns them as they are; override it to inspect, reorder or drop them.

func (*Worker) QueueFrame

func (w *Worker) QueueFrame(ctx context.Context, f frames.Frame, dir ...processor.Direction)

QueueFrame queues a frame, holding it when one of this worker's own tool handlers is what queued it.

A frame queued from inside a handler, or from anything that handler passes its context to, is held and delivered once the last call finishes. Everything else is queued at once: the worker's own traffic, what arrives over the bus, and what a handler on a different worker queues here, which this worker would never release.

Reaching past this to the embedded worker's QueueFrame queues without holding, which is what a caller wants when it is deliberately acting inside a call.

func (*Worker) ToolCallActive

func (w *Worker) ToolCallActive() bool

ToolCallActive reports whether any of this worker's tools is running.

func (*Worker) Tools

func (w *Worker) Tools() []frames.Tool

Tools are the tools the worker registered, which is what it advertises when it activates.

Jump to

Keyboard shortcuts

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