Agent SDK
ChatBotKit's Agent SDK (@chatbotkit/agent) gives you the building blocks for autonomous AI agents that plan tasks, call tools, and run multi-turn workflows without human intervention. Unlike simple chat completions, the Agent SDK's execute function loops autonomously - the agent plans, calls tools, tracks progress, and exits when the job is done.
Agents are defined as markdown files with YAML frontmatter, tools are plain objects with Zod schemas, and skills load from directory structures. Everything composes naturally and streams events in real time.
Key Features
- Autonomous execution: The
executefunction runs multi-turn loops with built-in planning, progress tracking, and exit control. - Single-turn completion: The
completefunction handles one iteration with tool calling for simpler use cases. - Typed tool definitions: Define tools as objects with a description, a Zod input schema, and an async handler.
- Built-in system tools:
executeautomatically providesplan,progress,exit, andaborttools to the agent. - Agent file loading: Load agent definitions from markdown files with
loadAgent- frontmatter for config, body for backstory. - Skills from directories: Load and hot-reload skills from folder structures with
loadSkillsandcreateSkillsFeature. - Full event streaming: Every tool call, iteration, token, and exit event streams as an async iterable.
Getting Started
Install the Agent SDK:
Define tools, load skills from a directory, and run an agent:
Explore the SDK documentation for the full API reference and check out blueprints for pre-built agent configurations you can customize.