ctxkeys

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ctxkeys provides shared context keys for cross-package value propagation. It exists as a lightweight, dependency-free package so that both adk and toolchain (and any future packages) can read/write the same context values without import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentNameFromContext

func AgentNameFromContext(ctx context.Context) string

AgentNameFromContext extracts the agent name from ctx. It returns an empty string if no agent name is present.

func DynamicAllowedToolsFromContext added in v0.7.0

func DynamicAllowedToolsFromContext(ctx context.Context) []string

DynamicAllowedToolsFromContext extracts the runtime tool allowlist from ctx. Returns nil if no allowlist is present.

func IsP2PRequest added in v0.7.0

func IsP2PRequest(ctx context.Context) bool

IsP2PRequest reports whether the context originates from a remote P2P peer request.

func PrincipalFromContext added in v0.7.0

func PrincipalFromContext(ctx context.Context) string

PrincipalFromContext extracts the principal from ctx. It returns an empty string if no principal is present.

func SpawnChainFromContext added in v0.7.0

func SpawnChainFromContext(ctx context.Context) []string

SpawnChainFromContext extracts the spawn chain from ctx. Returns nil if no spawn chain is present.

func SpawnDepthFromContext added in v0.7.0

func SpawnDepthFromContext(ctx context.Context) int

SpawnDepthFromContext extracts the spawn depth from ctx. Returns 0 if no spawn depth is present.

func WithAgentName

func WithAgentName(ctx context.Context, name string) context.Context

WithAgentName returns a new context carrying the given agent name.

func WithDynamicAllowedTools added in v0.7.0

func WithDynamicAllowedTools(ctx context.Context, tools []string) context.Context

WithDynamicAllowedTools returns a new context carrying a runtime tool allowlist. When non-empty, only listed tools (plus runtime essentials) may execute.

func WithP2PRequest added in v0.7.0

func WithP2PRequest(ctx context.Context) context.Context

WithP2PRequest returns a new context marked as originating from a P2P peer request.

func WithPrincipal added in v0.7.0

func WithPrincipal(ctx context.Context, principal string) context.Context

WithPrincipal returns a new context carrying the given principal name.

func WithSpawnChain added in v0.7.0

func WithSpawnChain(ctx context.Context, chain []string) context.Context

WithSpawnChain returns a new context carrying the agent spawn chain. The chain tracks the lineage of spawned agents for cycle detection.

func WithSpawnDepth added in v0.7.0

func WithSpawnDepth(ctx context.Context, depth int) context.Context

WithSpawnDepth returns a new context carrying the current agent spawn depth.

Types

This section is empty.

Jump to

Keyboard shortcuts

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