orchestratorcontext

package
v0.1.8-rc.21 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package orchestratorcontext provides context-scoped access to the running agent's identity. By injecting an Agent into ctx early in the pipeline (e.g. at Bootstrap / Start), any downstream code can retrieve the agent identity without explicit function parameters.

Usage:

ctx = orchestratorcontext.WithAgent(ctx, orchestratorcontext.Agent{Name: "my-bot"})
…
name := orchestratorcontext.AgentNameFromContext(ctx) // "my-bot"

Index

Constants

View Source
const DefaultAgentName = "Genie"

DefaultAgentName is returned when no Agent has been set on the context.

Variables

This section is empty.

Functions

func AgentNameFromContext

func AgentNameFromContext(ctx context.Context) string

AgentNameFromContext is a convenience function that returns the agent's Name from ctx, defaulting to DefaultAgentName.

func IsInternalTask

func IsInternalTask(ctx context.Context) bool

IsInternalTask returns true if the context was marked with WithInternalTask. This is intended as a marker that upstream code (e.g. the app layer) can inspect to adjust behavior for background system events, such as configuring the orchestrator to skip semantic cache and classification when needed.

func WithAgent

func WithAgent(ctx context.Context, a Agent) context.Context

WithAgent returns a copy of ctx that carries the given Agent.

func WithInternalTask

func WithInternalTask(ctx context.Context) context.Context

WithInternalTask marks the context as carrying an internal task (cron trigger, heartbeat, webhook event). Callers can use IsInternalTask to detect these system-initiated requests and, for example, set CodeQuestion.SkipClassification so the orchestrator bypasses the semantic cache and classification pipeline when appropriate.

Types

type Agent

type Agent struct {
	Name string
}

Agent holds the identity of the currently running agent. For now it only carries a Name; additional fields (e.g. Version, Description) can be added later without breaking callers.

func AgentFromContext

func AgentFromContext(ctx context.Context) Agent

AgentFromContext extracts the Agent from ctx. If no Agent was set on the context, it returns an Agent whose Name is DefaultAgentName.

Jump to

Keyboard shortcuts

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