@chinudotdev/agent
v0.1.3
Published
agent-core/v1 Agent SDK — typed tools, hooks, structured output
Maintainers
Readme
@chinudotdev/agent
Layer 1 Agent SDK for agent-core/v1 — typed tools, hooks, guards, structured output.
Requires an explicit provider (@chinudotdev/provider-openai, @chinudotdev/provider-anthropic, or your own Provider).
Install
npm install @chinudotdev/agent @chinudotdev/provider-openaiQuick start
import { Agent, tool } from "@chinudotdev/agent";
import { createOpenAIProvider } from "@chinudotdev/provider-openai";
const provider = createOpenAIProvider({
apiKey: process.env.OPENAI_API_KEY!,
});
const agent = new Agent({
model: "gpt-4o-mini",
system: "You are a helpful assistant.",
provider,
tools: [
tool({
name: "echo",
description: "Echo input",
inputSchema: { type: "object", properties: { text: { type: "string" } } },
handler: (args) => String((args as { text?: string }).text ?? ""),
}),
],
});
const result = await agent.collect("Say hello.");
console.log(result.output_text);Features
- Typed tool definitions with JSON Schema validation
- Observation hooks (
on_text_delta,on_tool_call_start, …) - Guard / veto deciders
- Structured output via
runStructured() - Streaming via
agent.stream()oragent.collect()
Examples
After install, runnable tutorials ship at node_modules/@chinudotdev/agent/examples/ (01–08). Install @chinudotdev/provider-openai alongside for the OpenAI examples (peerDependencies, optional at runtime).
Docs
License
MIT
