Documentation
¶
Overview ¶
Package http provides a generic HTTP/JSON agent bridge, so an agentDecision can be answered by any service that speaks a small, documented envelope — an internal classifier, a model gateway, or a colleague's Python service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge posts agent decisions to an HTTP endpoint.
type Option ¶
type Option func(*Bridge)
Option configures a Bridge.
func WithClient ¶
WithClient supplies the HTTP client. The engine enforces the per-decision latency budget through context cancellation, so a client timeout here is a belt-and-braces upper bound rather than the primary control.
func WithHeader ¶
WithHeader sets a header on every request — an API key, a tenant ID.
type RequestBody ¶
type RequestBody struct {
DecisionID string `json:"decision_id"`
DecisionName string `json:"decision_name,omitempty"`
Prompt string `json:"prompt"`
// Inputs is agent.Request.Inputs as-is: numbers as JSON numbers, every
// temporal and duration as its FEEL lexical string ("2024-03-05",
// "2024-03-05T10:00:00", "P1DT2H").
Inputs map[string]any `json:"inputs,omitempty"`
OutputType TypeSpec `json:"output_type"`
SessionHint string `json:"session_hint,omitempty"`
Attempt int `json:"attempt"`
}
RequestBody is what the bridge POSTs.
type ResponseBody ¶
type ResponseBody struct {
Value any `json:"value"`
SessionRef string `json:"session_ref,omitempty"`
InputTokens int `json:"input_tokens,omitempty"`
OutputTokens int `json:"output_tokens,omitempty"`
Model string `json:"model,omitempty"`
// Error lets a service report a semantic failure with a 200, which some
// gateways prefer; a non-empty Error is treated exactly like a transport
// failure and therefore participates in retry and the failure policy.
Error string `json:"error,omitempty"`
}
ResponseBody is what the bridge expects back. `value` is the only required field; everything else enriches the trace.
type TypeSpec ¶
type TypeSpec struct {
TypeRef string `json:"type_ref,omitempty"`
Enumeration []string `json:"enumeration,omitempty"`
Collection bool `json:"collection,omitempty"`
Components map[string]TypeSpec `json:"components,omitempty"`
}
TypeSpec is the JSON projection of the declared output type, so the remote service can build a matching structured-output schema.