Documentation
¶
Overview ¶
Package agent provides a minimal agent execution runtime: Anthropic API + tool use loop + MCP client + built-in HTTP tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMaxTurns = errors.New("agent: max turns reached")
ErrMaxTurns is returned when the agent exhausts MaxTurns without reaching end_turn.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent drives an Anthropic tool-use loop with optional MCP and built-in tools.
type Config ¶
type Config struct {
// MCPURL is the MCP server endpoint. If empty, no MCP tools are available.
MCPURL string
// MCPToken is the Bearer token sent to the MCP server.
MCPToken string
// SystemPrompt is prepended to every conversation as the system message.
SystemPrompt string
// Model is the Anthropic model ID. Defaults to "claude-sonnet-4-6".
Model string
// MaxTurns is the maximum number of tool-use loops before giving up. Defaults to 10.
MaxTurns int
// StreamableHTTP instructs the MCP client to use Streamable HTTP transport
// instead of SSE. Use this when connecting to GitHub MCP or any 2025-03-26+ server.
StreamableHTTP bool
}
Config holds the settings for an Agent run.
type Job ¶ added in v0.2.0
type Job struct {
// Schedule is a 5-field cron expression (e.g. "0 6 * * *").
Schedule string
// Timezone is the IANA timezone for the cron schedule (e.g. "Europe/Copenhagen").
// Empty defaults to UTC.
Timezone string
// Task is the prompt passed to Agent.Run on each scheduled execution.
Task string
// Config is the agent configuration for this job.
Config Config
}
Job defines a single scheduled agent task.
type Scheduler ¶ added in v0.2.0
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler wraps gocron and runs registered Jobs on their cron schedules. Jobs sharing a timezone share a gocron.Scheduler instance.
func NewScheduler ¶ added in v0.2.0
NewScheduler creates a Scheduler from a slice of Jobs. Returns an error if any job has an invalid timezone or cron expression.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
agent-forge
command
agent-forge connects to a forge-mcp server and summarises published posts.
|
agent-forge connects to a forge-mcp server and summarises published posts. |
|
agent-github
command
agent-github connects to the GitHub MCP server and summarises open issues.
|
agent-github connects to the GitHub MCP server and summarises open issues. |
|
scheduler
command
|
Click to show internal directories.
Click to hide internal directories.