Extract agent and tools from tracker mapping worker into dedicated files
Split tracker_mapping_worker.go: agent construction, prompts, and structured output type move to tracker_mapping_agent.go; each tool gets its own *_tool.go file. Update naming conventions (worker, agent, tool file patterns, AgentResult suffix, RunTyped preference). Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -24,7 +24,17 @@ result.FinalMessage().Text() // final output
|
||||
result.LastAgent // agent that produced the result
|
||||
```
|
||||
|
||||
Typed output via `RunTyped[T](ctx, agent, messages)` — validates against JSON Schema.
|
||||
Prefer `RunTyped[T]` over `Run` + manual unmarshalling when the agent declares a
|
||||
structured output type via `WithOutputType`. `RunTyped` validates the response
|
||||
against the JSON Schema and returns the typed value directly:
|
||||
|
||||
```go
|
||||
result, err := agent.RunTyped[TrackerIdentification](ctx, ag, messages)
|
||||
identification := result.Output // already typed, no json.Unmarshal needed
|
||||
```
|
||||
|
||||
Only fall back to `agent.Run` when the agent produces free-form text with no
|
||||
output schema.
|
||||
|
||||
## Tool interface
|
||||
|
||||
|
||||
Reference in New Issue
Block a user