orchestratorcontext

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 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 WithAgent

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

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

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