Documentation
¶
Overview ¶
Package agent defines the boundary between Verdict's deterministic evaluator and whatever answers an agentDecision node.
A bridge is deliberately thin. It receives a rendered prompt, the bound and FEEL-evaluated inputs, and the declared output type; it returns a value. It does not know it is inside a decision graph, does not see the model context, and does not enforce latency or retry — the engine owns all of that, so every bridge gets identical guarantees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge interface {
// Invoke answers one agent decision. Implementations should respect
// ctx cancellation; the engine cancels the context when the decision's
// latency budget expires.
Invoke(ctx context.Context, req Request) (Response, error)
}
Bridge evaluates an agent decision.
type BridgeFunc ¶
BridgeFunc adapts a function to the Bridge interface.
type Request ¶
type Request struct {
// DecisionID is the DRG element the request belongs to, for correlation.
DecisionID string
// DecisionName is the human-readable decision name.
DecisionName string
// Prompt is the rendered prompt template.
Prompt string
// Inputs are the bound, FEEL-evaluated inputs, converted to plain Go values.
Inputs map[string]any
// OutputType is the shape the response must conform to.
OutputType model.TypeSpec
// Trace lets the bridge record its own steps as children of the agent node.
Trace trace.Writer
// SessionHint is the model's optional request to reuse a session. A bridge
// that has no session concept ignores it.
SessionHint string
// Attempt is the zero-based retry attempt. A bridge may use it to vary
// temperature or to widen its instructions on a retry.
Attempt int
}
Request is one agent decision's call site, fully bound.
type Response ¶
type Response struct {
// Value must conform to Request.OutputType. Plain Go values are expected;
// the engine coerces and validates before binding.
Value any
// SessionRef identifies the agent run in the bridge's own world — a Nexus
// session ID, a provider request ID — and is recorded in the trace so the
// run stays forensically available after the fact.
SessionRef string
// Tokens is optional cost telemetry.
Tokens TokenAccounting
}
Response is a bridge's answer.
type TokenAccounting ¶
type TokenAccounting struct {
Input int `json:"input,omitempty"`
Output int `json:"output,omitempty"`
Total int `json:"total,omitempty"`
// Model names the model that answered, when the bridge knows it.
Model string `json:"model,omitempty"`
}
TokenAccounting is optional per-invocation cost telemetry.
Directories
¶
| Path | Synopsis |
|---|---|
|
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.
|
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. |
|
Package mock provides a deterministic in-memory agent bridge for tests and for running agent-bearing models in CI without an LLM.
|
Package mock provides a deterministic in-memory agent bridge for tests and for running agent-bearing models in CI without an LLM. |