Documentation
¶
Index ¶
- Constants
- Variables
- func AgentUserIDFromContext(ctx context.Context) string
- func SubAgentMaxDepthFromContext(ctx context.Context) int
- func WebSearchRunnerFromContext(ctx context.Context) any
- func WithAgentUserID(ctx context.Context, userID string) context.Context
- func WithPromptFn(ctx context.Context, fn PromptFn) context.Context
- func WithSubAgentMaxDepth(ctx context.Context, depth int) context.Context
- func WithWebSearchRunner(ctx context.Context, fn any) context.Context
- type APIChunkType
- type APIProvider
- type APIRequest
- type APIResponse
- type APIResponseChunk
- type ContentBlock
- type ContextWindow
- type ExecutionOrigin
- type ImageContent
- type Message
- type ModelIdentifier
- type PermissionMode
- type PromptFn
- type PromptOption
- type PromptRequest
- type PromptResponse
- type PromptType
- type Role
- type RuntimeEvent
- type RuntimeEventType
- type SessionID
- type TextContent
- type TokenUsage
- type ToolPermissionRequest
- type ToolResultContent
- type ToolUseContent
- type TurnID
Constants ¶
const ( APIChunkTypeContentBlockStart = internaltypes.APIChunkTypeContentBlockStart APIChunkTypeContentBlockDelta = internaltypes.APIChunkTypeContentBlockDelta APIChunkTypeContentBlockStop = internaltypes.APIChunkTypeContentBlockStop APIChunkTypeMessageDelta = internaltypes.APIChunkTypeMessageDelta APIChunkTypeMessageStop = internaltypes.APIChunkTypeMessageStop APIChunkTypeError = internaltypes.APIChunkTypeError APIProviderAnthropic = internaltypes.APIProviderAnthropic APIProviderBedrock = internaltypes.APIProviderBedrock APIProviderCodex = internaltypes.APIProviderCodex APIProviderDeepSeek = internaltypes.APIProviderDeepSeek APIProviderFoundry = internaltypes.APIProviderFoundry APIProviderGemini = internaltypes.APIProviderGemini APIProviderKimi = internaltypes.APIProviderKimi APIProviderMiniMax = internaltypes.APIProviderMiniMax APIProviderMistral = internaltypes.APIProviderMistral APIProviderOllama = internaltypes.APIProviderOllama APIProviderOpenAI = internaltypes.APIProviderOpenAI APIProviderOpenCode = internaltypes.APIProviderOpenCode APIProviderOpenRouter = internaltypes.APIProviderOpenRouter APIProviderVertex = internaltypes.APIProviderVertex APIProviderWorkersAI = internaltypes.APIProviderWorkersAI APIProviderZAi = internaltypes.APIProviderZAi ExecutionOriginInteractive = internaltypes.ExecutionOriginInteractive ExecutionOriginAutomation = internaltypes.ExecutionOriginAutomation ExecutionOriginSkillAgent = internaltypes.ExecutionOriginSkillAgent PermissionModeOnRequest = internaltypes.PermissionModeOnRequest PermissionModeAuto = internaltypes.PermissionModeAuto PermissionModeAcceptEdits = internaltypes.PermissionModeAcceptEdits PermissionModeBypass = internaltypes.PermissionModeBypass PermissionModeNever = internaltypes.PermissionModeNever PermissionModeGranular = internaltypes.PermissionModeGranular PromptTypeConfirm = internaltypes.PromptTypeConfirm RoleAssistant = internaltypes.RoleAssistant RoleUser = internaltypes.RoleUser RoleSystem = internaltypes.RoleSystem RuntimeEventTypePromptRequired = internaltypes.RuntimeEventTypePromptRequired RuntimeEventTypeToolPermissionRequired = internaltypes.RuntimeEventTypeToolPermissionRequired StopReasonEndTurn = internaltypes.StopReasonEndTurn )
Variables ¶
var RuntimeEventEmitterKey = internaltypes.RuntimeEventEmitterKey
Functions ¶
func AgentUserIDFromContext ¶
AgentUserIDFromContext returns the user ID from ctx, or empty string if absent.
func SubAgentMaxDepthFromContext ¶
SubAgentMaxDepthFromContext returns the configured depth limit from ctx, or 0 if none was set (caller should then use the server default constant).
func WebSearchRunnerFromContext ¶
WebSearchRunnerFromContext returns the current turn's web_search runner (as `any` - assert to sdk.WebSearchRunnerFn), or nil if none was set.
func WithAgentUserID ¶
WithAgentUserID returns a context carrying the authenticated user's ID.
func WithPromptFn ¶
WithPromptFn returns a context carrying this turn's interactive-prompt bridge (consumed by ask_user_question and the permission integrator). Prefer this over Client.SetPromptFn / Session.SetPromptFn when the same *sdk.Client may be reused across concurrent turns (e.g. a per-user/provider client cache) - those setters mutate shared state on the client/tools and would otherwise race between turns sharing that client.
func WithSubAgentMaxDepth ¶
WithSubAgentMaxDepth returns a context carrying the user-configured sub-agent depth limit. The agent tool reads this to override the server-wide default. Pass 0 to clear any override and fall back to the server default.
func WithWebSearchRunner ¶
WithWebSearchRunner returns a context carrying this turn's web_search execution runner (fn should be an sdk.WebSearchRunnerFn). Prefer this over Client.SetWebSearchRunner for the same reason as WithPromptFn above.
Types ¶
type APIChunkType ¶
type APIChunkType = internaltypes.APIChunkType
APIChunkType represents the type of chunk in a streaming response
type APIProvider ¶
type APIProvider = internaltypes.APIProvider
APIProvider represents the API provider being used
type APIRequest ¶
type APIRequest = internaltypes.APIRequest
APIRequest represents a request to the API
type APIResponse ¶
type APIResponse = internaltypes.APIResponse
APIResponse represents a complete API response
type APIResponseChunk ¶
type APIResponseChunk = internaltypes.APIResponseChunk
APIResponseChunk represents a chunk of a streaming API response
type ContentBlock ¶
type ContentBlock = internaltypes.ContentBlock
ContentBlock represents a single block of content in a message
type ContextWindow ¶
type ContextWindow = internaltypes.ContextWindow
ContextWindow represents the context window for a model
func GetContextWindow ¶
func GetContextWindow(model ModelIdentifier) ContextWindow
GetContextWindow returns the context window for a model. It consults the centralised model.Global registry first; if the model is not found there it falls back to a conservative default (128k/4k).
type ExecutionOrigin ¶
type ExecutionOrigin = internaltypes.ExecutionOrigin
ExecutionOrigin indicates whether a run is initiated by an interactive user flow or a future background automation.
func NormalizeExecutionOrigin ¶
func NormalizeExecutionOrigin(raw string) ExecutionOrigin
NormalizeExecutionOrigin returns the execution origin that raw names (automation or skill agent), and the interactive origin for anything else.
type ImageContent ¶
type ImageContent = internaltypes.ImageContent
ImageContent represents an image content block
type Message ¶
type Message = internaltypes.Message
Message represents a single message in the conversation
func UserMessage ¶
UserMessage builds a single-turn user Message - the minimal constructor needed by callers doing a one-shot providers.Client.CreateMessage call (title generation, memory extraction, and similar) rather than a full agentic sdk.Session.
type ModelIdentifier ¶
type ModelIdentifier = internaltypes.ModelIdentifier
ModelIdentifier uniquely identifies a model
type PermissionMode ¶
type PermissionMode = internaltypes.PermissionMode
PermissionMode represents the mode of APPROVAL checking. This determines WHO approves actions (user, classifier, etc.)
func NormalizePermissionMode ¶
func NormalizePermissionMode(raw string) (PermissionMode, bool)
NormalizePermissionMode returns the permission mode that raw names, and false when raw is not a known mode.
func NormalizePermissionModeOrDefault ¶
func NormalizePermissionModeOrDefault(mode PermissionMode, fallback PermissionMode) PermissionMode
NormalizePermissionModeOrDefault returns mode when it is a known mode, otherwise fallback when that is known, otherwise the on-request mode.
type PromptFn ¶
type PromptFn = internaltypes.PromptFn
PromptFn is a function that can prompt the user
func PromptFnFromContext ¶
PromptFnFromContext returns the current turn's prompt bridge, or nil if none was set.
type PromptOption ¶
type PromptOption = internaltypes.PromptOption
PromptOption represents an option in a choice prompt
type PromptRequest ¶
type PromptRequest = internaltypes.PromptRequest
PromptRequest represents a request to prompt the user
type PromptResponse ¶
type PromptResponse = internaltypes.PromptResponse
PromptResponse represents a response from the user
type PromptType ¶
type PromptType = internaltypes.PromptType
PromptType represents the type of prompt
type RuntimeEvent ¶
type RuntimeEvent = internaltypes.RuntimeEvent
RuntimeEvent is the structured event envelope emitted by the runtime.
type RuntimeEventType ¶
type RuntimeEventType = internaltypes.RuntimeEventType
RuntimeEventType identifies a structured runtime event emitted during a turn.
type TextContent ¶
type TextContent = internaltypes.TextContent
TextContent represents a text content block
type TokenUsage ¶
type TokenUsage = internaltypes.TokenUsage
TokenUsage represents token usage information
type ToolPermissionRequest ¶
type ToolPermissionRequest = internaltypes.ToolPermissionRequest
ToolPermissionRequest represents a structured permission check request.
type ToolResultContent ¶
type ToolResultContent = internaltypes.ToolResultContent
ToolResultContent represents a tool result content block
type ToolUseContent ¶
type ToolUseContent = internaltypes.ToolUseContent
ToolUseContent represents a tool use content block