zig-agentslisted
Install: claude install-skill satibot/satibot
# Zig Agent Development
## Overview
This skill covers patterns for building AI agents in Zig, including:
- Tool system design and implementation
- Conversation context management
- LLM provider abstractions
- Streaming response handling
- Session persistence
- Agent loop patterns
## Architecture
```text
Agent
├── Config # API keys, model settings
├── Context # Conversation history
├── ToolRegistry # Available tools
├── Provider # LLM API abstraction
└── Session # Persistence layer
```
### Agent Loop Pattern
The core agent loop follows this flow:
```text
1. Add user message to context
2. Loop (max N iterations):
a. Call LLM with context + tools
b. Add assistant response to context
c. If tool calls present:
- Execute each tool
- Add tool results to context
- Continue loop
d. Else: break
3. Save session
```
## Tool System
### Tool Definition
```zig
pub const ToolContext = struct {
allocator: std.mem.Allocator,
config: Config,
};
pub const Tool = struct {
name: []const u8,
description: []const u8,
parameters: []const u8, // JSON Schema
execute: *const fn (ctx: ToolContext, arguments: []const u8) anyerror![]const u8,
};
```
### Tool Registry
```zig
pub const ToolRegistry = struct {
tools: std.StringHashMap(Tool),
allocator: std.mem.Allocator,
pub fn init(allocator: std.mem.Allocator) ToolRegistry {
return .{
.tools = std.Strin