cogni
Cogni
Cogni is a Crystal-first runtime for building deterministic workflow systems with agents, tools, skills, triggers, and HTTP APIs.
Licenses: ISC (LICENSE) and 0BSD (LICENSE-0BSD).
Why Cogni
- Build workflow bundles in Crystal with explicit execution graphs.
- Run the same workflows through CLI triggers or HTTP endpoints.
- Compose agents, external tools, skills, voice flows, and RAG steps in one runtime.
- Extend the runtime through registered node kinds and resources.
- Keep schemas, validation, and workflow behavior explicit and testable.
Quickstart
Build the CLI:
crystal build src/cli/main.cr -o build/cogni
Start the runtime:
./build/cogni up --port 4111
List workflows:
curl -sS http://127.0.0.1:4111/v1/workflows | jq
Run the Svelte playground:
cd packages/playground
bun install
bun run dev
Run the docs site:
cd packages/docs
bun install
bun run dev
Core Concepts
Workflows
Cogni workflows are declared in .acd.cr bundles or built programmatically with Cogni::Workflow.build(...). The preferred workflow API is the unified step model:
workflow = Cogni::Workflow.build("review")
workflow
.step("agent", "triage", prompt: "Classify the request")
.step("exec", "tools/analyze.sh", runtime: {"shell" => JSON.parse("bash".to_json)})
.step("node_kind", "delegate", node_kind_name: "agent_codex")
.commit
Use Workflow#step(type, id, ...) for built-in nodes and external node kinds. For custom node kind instances, use Workflow#step(Cogni::NodeKind.new(...), id: ...).
Registry Extensions
Extend the runtime through Cogni::RegistryApi:
Cogni::RegistryApi.node_kind("crystal_native") do |_ctx, attributes|
{
"status" => JSON.parse("ok".to_json),
"message" => attributes["message"]? || JSON.parse("none".to_json),
}
end
Cogni::RegistryApi.resource("resource_ping") do |_ctx, payload|
{
"task" => JSON.parse((payload["task"]?.try(&.as_s?) || "none").to_json),
}
end
Register node kinds only via Cogni::RegistryApi.node_kind and resource handlers only via Cogni::RegistryApi.resource.
Built-in External Agent Step Types
External agent nodes are exposed through unified step types:
agent_cliproxyagent_codexagent_opencode
These are registered as node kinds and can be used through the unified step model.
Running Workflows
CLI trigger examples:
./build/cogni workflow solver task=deploy env=prod
./build/cogni agent code-reviewer --prompt "review this patch"
./build/cogni tool project_healthcheck
./build/cogni support onboarding-check
HTTP runtime examples:
GET /v1/workflowsGET /v1/workflows/:workflowIdPOST /v1/workflows/:workflowId/runsPOST /v1/triggers/workflows/:idPOST /v1/triggers/agents/:idPOST /v1/triggers/skills/:idPOST /v1/triggers/functions/:idPOST /v1/chat/completions
Extending The Framework
Cogni is organized around a few extension surfaces:
- declarative runtime:
src/framework/workflows/declarative - DSL and schemas:
src/framework/workflows/dsl - registry API:
src/framework/registry/api.cr - HTTP runtime:
src/framework/http
The runtime direction is additive and explicit:
- prefer
Workflow#step(type, id, ...) - use
agent_cliproxy,agent_codex, andagent_opencodeas external agent step types - use
Cogni::NodeKind.new(...)when you need an explicit node kind object - keep runtime behavior deterministic
Examples
Reference bundles live in shards/examples:
agents-exampleskills-exampleworkflow-examplevoice-playgroundrag-playgroundsimple-model-testfull-capabilitiescontrol-flowconfig-example
Run them together:
./build/cogni up --port 4111 --workflows-root ./shards/examples
Docs Map
- Overview:
packages/docs/index.md - Quickstart:
packages/docs/guides/quickstart.md - Core concepts:
packages/docs/guides/core-concepts.md - Workflow format:
packages/docs/guides/workflow-format.md - Registry and extensions:
packages/docs/guides/registry.md - Examples:
packages/docs/guides/examples.md - API reference:
packages/docs/api/reference.md
Current Notes
- The HTTP runtime is the main integration surface; trigger endpoints are the canonical invocation layer.
- Voice and RAG are workflow node types, not separate product areas.
- Some operational guides remain in
packages/docs/guides, but they are secondary to the core framework docs.
cogni
- 5
- 1
- 0
- 0
- 3
- 5 days ago
- February 15, 2026
ISC License
Mon, 13 Apr 2026 10:09:22 GMT