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 ¶
- func AgentNameFromContext(ctx context.Context) string
- func DynamicAllowedToolsFromContext(ctx context.Context) []string
- func IsP2PRequest(ctx context.Context) bool
- func PrincipalFromContext(ctx context.Context) string
- func SpawnChainFromContext(ctx context.Context) []string
- func SpawnDepthFromContext(ctx context.Context) int
- func WithAgentName(ctx context.Context, name string) context.Context
- func WithDynamicAllowedTools(ctx context.Context, tools []string) context.Context
- func WithP2PRequest(ctx context.Context) context.Context
- func WithPrincipal(ctx context.Context, principal string) context.Context
- func WithSpawnChain(ctx context.Context, chain []string) context.Context
- func WithSpawnDepth(ctx context.Context, depth int) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentNameFromContext ¶
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
DynamicAllowedToolsFromContext extracts the runtime tool allowlist from ctx. Returns nil if no allowlist is present.
func IsP2PRequest ¶ added in v0.7.0
IsP2PRequest reports whether the context originates from a remote P2P peer request.
func PrincipalFromContext ¶ added in v0.7.0
PrincipalFromContext extracts the principal from ctx. It returns an empty string if no principal is present.
func SpawnChainFromContext ¶ added in v0.7.0
SpawnChainFromContext extracts the spawn chain from ctx. Returns nil if no spawn chain is present.
func SpawnDepthFromContext ¶ added in v0.7.0
SpawnDepthFromContext extracts the spawn depth from ctx. Returns 0 if no spawn depth is present.
func WithAgentName ¶
WithAgentName returns a new context carrying the given agent name.
func WithDynamicAllowedTools ¶ added in v0.7.0
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
WithP2PRequest returns a new context marked as originating from a P2P peer request.
func WithPrincipal ¶ added in v0.7.0
WithPrincipal returns a new context carrying the given principal name.
func WithSpawnChain ¶ added in v0.7.0
WithSpawnChain returns a new context carrying the agent spawn chain. The chain tracks the lineage of spawned agents for cycle detection.
Types ¶
This section is empty.