agent()
import { agent } from '@polymatx/weave';Signature
Section titled “Signature”agent(config: AgentConfig): AgentAgentConfig
Section titled “AgentConfig”| Field | Type | Required | Default |
|---|---|---|---|
model | LanguageModel (Vercel AI SDK) | yes | — |
name | string | no | agent-<nanoid(6)> |
system | string | no | — |
tools | Record<string, Tool> | no | {} |
maxSteps | number | no | 5 |
temperature | number | no | provider default |
Returned Agent
Section titled “Returned Agent”run(input, options?)→Promise<AgentRunResult>stream(input, options?)→AgentStreamResult({textStream,finalResult})asNode(inputFrom, outputTo)→ graph node functionstreamAsNode(inputFrom, outputTo)→ streaming graph node function
AgentRunResult
Section titled “AgentRunResult”{ text: string; usage: { promptTokens, completionTokens, totalTokens }; toolCalls: ToolCallRecord[]; durationMs: number;}