docs: README coverage for resolvers, DefineTool, agent hooks, ops controls
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,16 @@ Aliases may appear anywhere in a chain (head, middle, tail), may reference
|
|||||||
other aliases, and expand inline and recursively; cycles are detected and
|
other aliases, and expand inline and recursively; cycles are detected and
|
||||||
returned as errors.
|
returned as errors.
|
||||||
|
|
||||||
|
For tiers that live in a database or config system, register a **dynamic
|
||||||
|
resolver** — consulted after static aliases, output expanded with the same
|
||||||
|
recursion and cycle guards:
|
||||||
|
|
||||||
|
```go
|
||||||
|
reg.RegisterResolver(majordomo.ResolverFunc(func(name string) (string, bool) {
|
||||||
|
return myConfigStore.LookupTier(name) // e.g. "agent-thinking" → a chain
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
### Failover & health
|
### Failover & health
|
||||||
|
|
||||||
Chains are health-tracked per target:
|
Chains are health-tracked per target:
|
||||||
@@ -93,6 +103,9 @@ Chains are health-tracked per target:
|
|||||||
configurable via `WithChainConfig` / `WithHealthConfig`.
|
configurable via `WithChainConfig` / `WithHealthConfig`.
|
||||||
- If every element fails, you get one joined error naming each target and
|
- If every element fails, you get one joined error naming each target and
|
||||||
why it failed.
|
why it failed.
|
||||||
|
- Ops surfaces: `reg.Health()` exposes `Bench`/`Unbench`/`Snapshot` for
|
||||||
|
manual control and dashboards; `ChainConfig.Observer` receives one event
|
||||||
|
per failover decision (failed attempt, bench, benched-skip) for logging.
|
||||||
|
|
||||||
## Providers
|
## Providers
|
||||||
|
|
||||||
@@ -188,6 +201,17 @@ resp, _ := m.Generate(ctx, req, majordomo.WithTools(weather))
|
|||||||
// resp.ToolCalls → execute → append ToolResultsMessage → continue
|
// resp.ToolCalls → execute → append ToolResultsMessage → continue
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or typed, with the schema derived from your argument struct:
|
||||||
|
|
||||||
|
```go
|
||||||
|
weather := majordomo.DefineTool("get_weather", "Current weather for a city",
|
||||||
|
func(ctx context.Context, args struct {
|
||||||
|
City string `json:"city" description:"city name"`
|
||||||
|
}) (any, error) {
|
||||||
|
return lookup(args.City)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
Each provider maps this one shape to its native function-calling format
|
Each provider maps this one shape to its native function-calling format
|
||||||
(OpenAI tools/tool_calls, Anthropic tool_use/tool_result, Ollama tools with
|
(OpenAI tools/tool_calls, Anthropic tool_use/tool_result, Ollama tools with
|
||||||
object arguments). Tool-call ids are synthesized when a backend omits them;
|
object arguments). Tool-call ids are synthesized when a backend omits them;
|
||||||
@@ -237,6 +261,13 @@ the model can react to; unknown tools likewise; duplicate tool names across
|
|||||||
toolboxes fail loudly. On `agent.ErrMaxSteps` (and on model errors) the
|
toolboxes fail loudly. On `agent.ErrMaxSteps` (and on model errors) the
|
||||||
partial result with the full transcript is still returned.
|
partial result with the full transcript is still returned.
|
||||||
|
|
||||||
|
Supervision hooks for orchestrators: `WithMaxStepsFunc` (dynamic step
|
||||||
|
budget), `WithSteer` (inject messages into a running agent),
|
||||||
|
`WithCompactor` (transform the outbound transcript when context grows —
|
||||||
|
the canonical `Result.Messages` stays complete), and `WithToolErrorLimits`
|
||||||
|
(circuit breakers for all-error steps and identical repeated calls,
|
||||||
|
surfacing `agent.ErrToolLoop`).
|
||||||
|
|
||||||
## Skills
|
## Skills
|
||||||
|
|
||||||
Skills are reusable instruction+tool bundles attachable to **any** agent,
|
Skills are reusable instruction+tool bundles attachable to **any** agent,
|
||||||
|
|||||||
Reference in New Issue
Block a user