Pick your starting point
Two paths — both use the samequery() function.
Path 1 — With a GitAgent repo URL
agent.yaml + SOUL.md + skills. Zero config — the repo is your agent.
Path 2 — Without a repo
API Reference
query()
tool()
buildTool()
hooks
QueryOptions
Parameters accepted byquery()
| Name | Type | Required | Description |
|---|---|---|---|
prompt | string | AsyncIterable | Yes | User prompt or multi-turn stream |
dir | string | Agent directory (default: cwd) | |
model | string | ”provider:model-id” | |
env | string | Environment config (config/<env>.yaml) | |
systemPrompt | string | Override discovered system prompt | |
systemPromptSuffix | string | Append to discovered system prompt | |
tools | GCToolDefinition[] | Additional tools | |
replaceBuiltinTools | boolean | Skip cli/read/write/memory | |
allowedTools | string[] | Tool name allowlist | |
disallowedTools | string[] | Tool name denylist | |
maxTurns | number | Max agent turns | |
abortController | AbortController | Cancellation signal | |
constraints | object | temperature, maxTokens, topP, topK | |
hooks | object | onSessionStart, preToolUse, postToolFailure, preQuery, postResponse, fileChanged, onError lifecycle hooks | |
repo | object | Work on a remote git repo — clone, run agent, auto-commit changes to session branch | |
sandbox | SandboxOptions | boolean | Run agent inside an E2B cloud VM (true uses defaults) | |
sessionId | string | Tag or resume a specific session |
Message Types
Emitted by thequery() async iterator
| Type | Fields | Description |
|---|---|---|
delta | deltaType, content | Streaming text/thinking chunk |
assistant | content, model, usage, stopReason | Complete LLM response |
tool_use | toolName, args, toolCallId | Tool invocation |
tool_result | toolName, content, isError, toolCallId | Tool output |
system | subtype, content, metadata | Lifecycle events |
user | content | User message (multi-turn) |
Cost Tracking
See Utilities for the full shape of the
costs() result and for context-compaction helpers.SDK Quickstart
Install the SDK and run your first query()
Utilities
Context compaction and cost tracking helpers
Telemetry
OpenTelemetry spans, metrics, and Jaeger setup
Capabilities: Tools
Built-in tools available to every agent