by cocoyes
A model-agnostic, stateless Go agent runtime featuring dual-IR planning, dependency-aware batch scheduling, capability-driven MCP/tool orchestration, policy-based failure recovery, conditional replanning, side-effect control, and end-to-end execution observability. 知枝(Zhizhi)智能体运行时框架,基于 Go 构建,支持任务规划、MCP 工具编排、故障恢复及全链路可观测性。
# Add to your Claude Code skills
git clone https://github.com/cocoyes/zhizhi-agent-runtimeGuides for using ai agents skills like zhizhi-agent-runtime.
Last scanned: 10/23/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-10-23T09:08:04.103Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}See how zhizhi-agent-runtime compares with popular alternatives.
zhizhi-agent-runtime is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by cocoyes. A model-agnostic, stateless Go agent runtime featuring dual-IR planning, dependency-aware batch scheduling, capability-driven MCP/tool orchestration, policy-based failure recovery, conditional replanning, side-effect control, and end-to-end execution observability. 知枝(Zhizhi)智能体运行时框架,基于 Go 构建,支持任务规划、MCP 工具编排、故障恢复及全链路可观测性。. It has 181 GitHub stars.
Yes. zhizhi-agent-runtime passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/cocoyes/zhizhi-agent-runtime" and add it to your Claude Code skills directory (see the Installation section above).
zhizhi-agent-runtime is primarily written in Go. It is open-source under cocoyes on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh zhizhi-agent-runtime against similar tools.
No comments yet. Be the first to share your thoughts!
From $49 · 30 days · terms & refunds
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
Automated security scan — not a certification.
中文文档 · Zhizhi Official Website · API Reference · Changelog
Zhizhi (知枝) is a Go runtime for building AI Agents. Connect a model, register your business functions as tools, and let the Agent call them to complete tasks. For multi-step work, the runtime supports planning, parallel execution, conditional branches, and bounded recovery.
Use it inside a Go service, assistant, or automation application. You supply the model and business integrations; Zhizhi manages tool execution, budgets, approval checkpoints, and execution evidence.
Requires Go 1.25+ and a model endpoint. The built-in adapter supports OpenAI-compatible Chat Completions; you can also implement the model.Model interface for another provider. Tool workflows require a model that supports tool calling. Docker is optional and needed only for Skill script execution.
go get github.com/cocoyes/zhizhi-agent-runtime@v1.1.1
package main
import (
"context"
"fmt"
"log"
"os"
zhizhi "github.com/cocoyes/zhizhi-agent-runtime"
"github.com/cocoyes/zhizhi-agent-runtime/adapter/model/openaicompat"
)
func main() {
model := openaicompat.New(openaicompat.Config{
BaseURL: os.Getenv("LLM_BASE_URL"),
APIKey: os.Getenv("LLM_API_KEY"),
Model: os.Getenv("LLM_MODEL"),
})
agent, err := zhizhi.New(zhizhi.WithModel(model))
if err != nil { log.Fatal(err) }
defer agent.Close(context.Background())
response, err := agent.Run(context.Background(), zhizhi.Request{
Input: "Explain what an AI Agent can do in three sentences",
})
if err != nil { log.Fatal(err) }
fmt.Println(response.Text)
}
export LLM_BASE_URL="https://your-provider.example/v1"
export LLM_API_KEY="your-api-key"
export LLM_MODEL="your-model"
go run ./examples/00-chat
Save the Go code as main.go in your own module and run go run . with those environment variables. To use the repository examples, clone this repository and run the example command from its root. Set LLM_BASE_URL to the API base URL, such as https://your-provider.example/v1; the adapter appends /chat/completions.
The following snippets extend the quickstart and assume model is configured and ctx is a request context. Add the indicated package imports and handle initialization errors before using an Agent. Always close Agents and streams when finished.
Tools are normal typed Go functions. Schemas are reflected automatically and arguments/results are validated at runtime.
type WeatherInput struct {
City string `json:"city" jsonschema:"required"`
}
type WeatherOutput struct {
City string `json:"city"`
Condition string `json:"condition"`
Temperature int `json:"temperature"`
}
weather := tool.Func(
"weather.current",
"Get the current weather for a city",
func(ctx context.Context, in WeatherInput) (WeatherOutput, error) {
return WeatherOutput{City: in.City, Condition: "sunny", Temperature: 27}, nil
},
tool.WithCapabilities("weather.current"),
)
agent, err := zhizhi.New(zhizhi.WithModel(model), zhizhi.WithTools(weather))
Tool descriptions are part of the model interface. Describe what a tool does and when it should be used. Keep IDs stable and specific; the runtime resolves the selected capability to the registered implementation.
The weather data above is illustrative. Replace the function body with your own API or service call. Import github.com/cocoyes/zhizhi-agent-runtime/tool, then ask the Agent about a city's weather. See the complete tool example.
stream, err := agent.Stream(ctx, zhizhi.Request{Input: "Tell me a short story"})
if err != nil { return err }
defer stream.Close()
for {
event, err := stream.Recv(ctx)
if errors.Is(err, io.EOF) { break }
if err != nil { return err }
fmt.Print(event.TextDelta)
}
Import errors and io for the receive loop. The stream also exposes tool and execution lifecycle events; see the streaming example.
ctx := context.Background()
mode := zhizhi.RunModeAgentComplex
response, err := agent.Run(ctx, zhizhi.Request{
Input: "Plan tonight's activities in Shenzhen based on the weather",
Mode: &mode,
})
Register the tools needed for the task first. Complex mode builds a dependency graph, passes results between steps, runs independent steps in parallel, and can replan within the configured budget when a required step fails. See the complete Agent example and the household workflow.
// import runtimemcp "github.com/cocoyes/zhizhi-agent-runtime/mcp"
agent, err := zhizhi.New(
zhizhi.WithModel(model),
zhizhi.WithMCP(runtimemcp.Config{
ID: "internal-tools",
Transport: runtimemcp.TransportStreamableHTTP,
Endpoint: "https://tools.example.com/mcp",
AllowTools: []string{"customer.lookup", "ticket.search"},
}),
)
MCP connections are lazy by default. Use allowlists to control which remote tools are available. For multiple servers, mcp.NewCapabilityProvider with zhizhi.WithMCPCapabilityProvider lets the model select a server before its tool list is loaded. See the MCP client example.
A Skill is a directory containing a SKILL.md with name and description frontmatter and usage instructions:
skills/
└── greeting/
└── SKILL.md
---
name: greeting
description: Compose a short greeting for a named person.
---
Ask for the person's name if it is missing, then write a friendly greeting.
// import "github.com/cocoyes/zhizhi-agent-runtime/skill"
catalog := skill.NewCatalog(skill.CatalogOptions{})
if _, err := catalog.LoadRoot(ctx, "./skills"); err != nil {
return err
}
agent, err := zhizhi.New(
zhizhi.WithModel(model),
zhizhi.WithSkillProvider(catalog, zhizhi.SkillOptions{}),
)
LoadRoot indexes names, descriptions, and directories in memory. Calling it again atomically refreshes that root; a failed scan preserves the previous index. The model sees skills.search and skills.invoke, discovers candidates, and loads instructions only after selection. The full Skill library is not included in every request.
To let a Skill call business tools, register them with WithTools and list their IDs in SkillOptions.AllowedTools. An empty list grants no business tools. See the Skill guide and the offline example.
Install Docker Engine, load your Skill catalog, and explicitly approve its script entrypoints. The example below assumes the catalog includes test-skill with scripts/hello.py:
// import "github.com/cocoyes/zhizhi-agent-runtime/skill/script"
// import dockerscript "github.com/cocoyes/zhizhi-agent-runtime/skill/script/docker"
executor, err := dockerscript.New(ctx, dockerscript.Config{
Enabled: true,
Catalog: catalog,
Image: "python:3.12-slim",
AutoPull: true,
Registrations: []script.Registration{{
SkillID: "test-skill",
Scripts: []script.EntryPoint{{Path: "scripts/hello.py"}},
}},
})
if err != nil { return err }
defer executor.Close(context.Background())
agent, err := zhizhi.New(
zhizhi.WithModel(model),
zhizhi.WithSkillProvider(catalog, zhizhi.SkillOptions{
ScriptExecutor: executor,
}),
)
Only the selected Skill receives run_skill_script. Each call uses a separate temporary container; images are reused, containers are removed, and task outputs can be read through the executor. You do not need host Python or a manually created container. With AutoPull: true, the first run downloads a missing image.
Defaults include non-root execution, read-only Skill files, disabled networking, and CPU, memory, time, and output limits. This feature is intended for audited Skills. Docker API access is highly privileged; protect the process using it. See configuration and security boundaries, the runnable example, and the dependency image Dockerfile.
Pass a deadline or cancellation through context.Context, and configure per-Agent limits with WithBudget:
zhizhi.WithBudget(zhizhi.Budget{
MaxSteps: 12, MaxBatches: 8, MaxModelCalls: 6,
MaxToolCalls: 20, MaxReplans: 1, MaxParallelSteps: 4,
HardTimeout: 30 * time