draftcrew

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 13 Imported by: 0

README

DraftCrew

High-performance Go framework for AI agent orchestration.

Inspired by CrewAI — built for Go. Agents, tasks, crews, and all 6 process types (sequential, hierarchical, consensual, reflective, flow, state machine) in a single binary with zero runtime dependencies.

go get github.com/bzdvdn/draftcrew@latest

Why DraftCrew?

Python-based agent frameworks (CrewAI, AutoGen, LangGraph) are powerful but hit walls in production: GIL contention, no native concurrency, heavy dependency trees, and complex deployment. DraftCrew brings agent orchestration to Go's world:

  • Goroutines, not GIL — true parallel agent execution via Go's concurrency model
  • Static typing — catch misconfigurations at compile time, not runtime
  • Single binary — no Python runtime, no pip install, no virtualenvs
  • Type-safe toolsGetOutput[T](result) via generics, zero reflection
  • Production observability — built-in event bus, telemetry, OpenTelemetry bridging
  • MCP-native — Model Context Protocol client for tool discovery (stdio + SSE)

Status: v0.1.0 PoC

The framework is functional and tested: all core primitives work, 11 packages have ≥80% coverage, GODOC covers every exported symbol. Not yet feature-complete vs CrewAI — see below for what's coming.

What works today
Feature Status
Agent with ReAct loop, tool calling, memory
Task with context passing, HITL
Crew: sequential, hierarchical, consensual, reflective, flow, state machine
LLM providers: OpenAI, Anthropic, Gemini, DeepSeek, Mistral, Ollama, OpenRouter, Azure
Built-in tools: shell, calculator, file I/O, web search, ask human, delegate
MCP client (stdio + SSE)
YAML config parser
Event bus + telemetry + OTEL bridge
Eval criteria (contains, regex, LLM judge)
CLI (draftcrew run, draftcrew start)

Where we're heading

DraftCrew aims to match CrewAI's feature set and then surpass it in areas where Go excels. The roadmap:

Near-term (v0.2–v0.5)
  • A2A (Agent-to-Agent) protocol — direct agent messaging and negotiation
  • Sandboxed tool execution — WASM and Docker-backed tool isolation
  • Vector database integrations — pgvector, Chroma, Qdrant for RAG-native memory
  • Embedded dashboard — real-time agent monitoring via SSE
  • Checkpoint/resume — SQLite-backed crew state persistence across restarts
Long-term vision
  • Visual workflow builder — DAG-based crew designer
  • gRPC mesh server — distributed agent orchestration across machines
  • Cloud control plane — fleet management for production agent deployments
  • Training/fine-tuning pipeline — feedback-loop agent improvement
Out of scope (for now)

DraftCrew will not become a vector database, a training framework, or a cloud platform. We build the orchestration layer — you bring the infrastructure.

Quick start

package main

import (
    "context"
    "fmt"

    "github.com/bzdvdn/draftcrew/src/pkg/agent"
    "github.com/bzdvdn/draftcrew/src/pkg/crew"
    "github.com/bzdvdn/draftcrew/src/pkg/llm"
    "github.com/bzdvdn/draftcrew/src/pkg/task"
)

func main() {
    llmClient := llm.NewOpenAI("sk-...", "gpt-4")

    a := agent.New(agent.Config{
        Role:    "Researcher",
        Goal:    "Research Go 1.22 features",
        LLM:     llmClient,
        MaxIter: 15,
    })

    t := task.New(task.Config{
        Description:    "Find key features",
        ExpectedOutput: "List of features",
        Agent:          a,
    })

    c := crew.New(crew.Config{
        Agents:  []*agent.Agent{a},
        Tasks:   []*task.Task{t},
        Process: crew.ProcessSequential,
    })

    result, err := c.Kickoff(context.Background())
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", result)
}

See the Quickstart Guide for the full walkthrough.

Installation

go get github.com/bzdvdn/draftcrew@latest

Or install the CLI:

go install github.com/bzdvdn/draftcrew/cmd/draftcrew@latest

Requires Go 1.22+.

Documentation

Roadmap

Release Focus
v0.1 Foundation — core primitives, sequential process
v0.2 Process expansion — all 6 process types
v0.3 Production features — checkpointing, telemetry, OTEL
v0.4 Ecosystem — MCP, evals, CLI
v0.5 Dashboard — real-time monitoring, benchmarks
v0.1.0 PoC release — documented, tested, MIT-licensed

Detailed roadmap: ROADMAP.md

Contributing

We welcome contributions. See the specs for active work items and AGENTS.md for workflow conventions.

License

MIT — see LICENSE.

Documentation

Overview

Package draftcrew provides a high-performance, idiomatic Go framework for AI agent orchestration.

Basic usage:

llm := draftcrew.NewOpenAI(os.Getenv("OPENAI_API_KEY"), "gpt-4")
agent := draftcrew.NewAgent(draftcrew.AgentConfig{Role: "Researcher", Goal: "Find trends", LLM: llm})
task := draftcrew.NewTask(draftcrew.TaskConfig{Description: "Research Go 1.22", Agent: agent})
crew := draftcrew.NewCrew(draftcrew.CrewConfig{Agents: []*draftcrew.Agent{agent}, Tasks: []*draftcrew.Task{task}})
result, err := crew.Kickoff(context.Background())

Index

Constants

View Source
const (
	ProcessSequential   = crew.ProcessSequential
	ProcessHierarchical = crew.ProcessHierarchical
	ProcessConsensual   = crew.ProcessConsensual
	ProcessReflective   = crew.ProcessReflective
	ProcessFlow         = crew.ProcessFlow
	ProcessStateMachine = crew.ProcessStateMachine
)

ProcessType constants for crew execution modes.

View Source
const (
	PhaseAgentInit        = callback.PhaseAgentInit
	PhaseAgentThink       = callback.PhaseAgentThink
	PhaseAgentTool        = callback.PhaseAgentTool
	PhaseAgentOutput      = callback.PhaseAgentOutput
	PhaseAgentComplete    = callback.PhaseAgentComplete
	PhaseAgentError       = callback.PhaseAgentError
	PhaseTaskStart        = callback.PhaseTaskStart
	PhaseTaskComplete     = callback.PhaseTaskComplete
	PhaseTaskError        = callback.PhaseTaskError
	PhaseCrewStart        = callback.PhaseCrewStart
	PhaseCrewComplete     = callback.PhaseCrewComplete
	PhaseCrewError        = callback.PhaseCrewError
	PhaseHumanInput       = callback.PhaseHumanInput
	PhaseReviewRequired   = callback.PhaseReviewRequired
	PhaseFlowStart        = callback.PhaseFlowStart
	PhaseFlowNodeStart    = callback.PhaseFlowNodeStart
	PhaseFlowNodeComplete = callback.PhaseFlowNodeComplete
	PhaseFlowComplete     = callback.PhaseFlowComplete
)

Callback phase constants for agent, task, crew, and flow lifecycle events.

View Source
const (
	EventPhaseTransition = telemetry.EventPhaseTransition
	EventLLMCall         = telemetry.EventLLMCall
	EventToolExecution   = telemetry.EventToolExecution
	EventError           = telemetry.EventError
	EventCheckpoint      = telemetry.EventCheckpoint
)

Telemetry event type constants.

View Source
const (
	PhaseCheckpointSave = callback.PhaseCheckpointSave
	PhaseCheckpointLoad = callback.PhaseCheckpointLoad
	PhaseResumeStart    = callback.PhaseResumeStart
	PhaseResumeComplete = callback.PhaseResumeComplete
)

Checkpoint and resume callback phases.

Variables

View Source
var (
	NewOpenAI           = llm.NewOpenAI
	NewAnthropic        = llm.NewAnthropic
	NewGemini           = llm.NewGemini
	NewDeepSeek         = llm.NewDeepSeek
	NewMistral          = llm.NewMistral
	NewOpenRouter       = llm.NewOpenRouter
	NewAzureOpenAI      = llm.NewAzureOpenAI
	NewOllama           = llm.NewOllama
	NewOpenAICompatible = llm.NewOpenAICompatible
	WithTemperature     = llm.WithTemperature
	WithMaxTokens       = llm.WithMaxTokens
	WithTopP            = llm.WithTopP
	WithTools           = llm.WithTools
)

LLM provider constructors and options.

View Source
var (
	NewTool          = tools.New
	ShellTool        = tools.ShellTool
	CalculatorTool   = tools.CalculatorTool
	ReadFileTool     = tools.ReadFileTool
	WriteFileTool    = tools.WriteFileTool
	WebSearchTool    = tools.WebSearchTool
	AskHumanTool     = tools.AskHumanTool
	DelegateWorkTool = tools.DelegateWorkTool
)

Built-in tool constructors.

View Source
var (
	NewShortTerm    = memory.NewShortTerm
	NewEntityMemory = memory.NewEntityMemory
)

Memory store constructors.

View Source
var (
	ErrNoAgents           = errors.ErrNoAgents
	ErrNoTasks            = errors.ErrNoTasks
	ErrAgentNil           = errors.ErrAgentNil
	ErrLLMFailed          = errors.ErrLLMFailed
	ErrMaxIterations      = errors.ErrMaxIterations
	ErrMaxRPM             = errors.ErrMaxRPM
	ErrInvalidProcess     = errors.ErrInvalidProcess
	ErrToolFailed         = errors.ErrToolFailed
	ErrGuardrail          = errors.ErrGuardrail
	ErrTaskFailed         = errors.ErrTaskFailed
	ErrNoMatchingPath     = errors.ErrNoMatchingPath
	ErrCycleDetected      = errors.ErrCycleDetected
	WrapError             = errors.Wrap
	WrapErrorE            = errors.WrapE
	IsError               = errors.Is
	ErrCheckpointNotFound = errors.ErrCheckpointNotFound
)

Sentinel errors and error helpers.

View Source
var (
	NewFlow             = flow.New
	NewEventBus         = telemetry.NewEventBus
	NewMetricsCollector = telemetry.NewMetricsCollector
	NewCallbackBridge   = telemetry.NewCallbackBridge
	NewOTELBridge       = telemetry.NewOTELBridge
)

Constructor functions.

View Source
var (
	// ParseYAML parses a crew.yaml file.
	ParseYAML     = yamlconfig.Parse
	ParseYAMLFile = yamlconfig.ParseFile
	ToCrewConfig  = yamlconfig.ToCrewConfig
)

CLI entrypoint.

View Source
var NewAgent = agent.New

NewAgent creates a new Agent with the given configuration.

View Source
var NewCrew = crew.New

NewCrew creates a new Crew with the given configuration.

View Source
var NewTask = task.New

NewTask creates a new Task with the given configuration.

Functions

func GetOutput

func GetOutput[T any](r *crew.Result, taskID string) (T, error)

GetOutput extracts and unmarshals a typed result from a crew execution result.

Types

type Agent

type Agent = agent.Agent

Agent is a type alias for agent.Agent.

type AgentConfig

type AgentConfig = agent.Config

AgentConfig is a type alias for agent.Config.

type Callback

type Callback = callback.Callback

Callback is a type alias for callback.Callback.

type CallbackBridge

type CallbackBridge = telemetry.CallbackBridge

CallbackBridge is a type alias for telemetry.CallbackBridge.

type Checkpoint

type Checkpoint = crew.Checkpoint

Checkpoint is a type alias for crew.Checkpoint.

type CheckpointStore

type CheckpointStore = crew.CheckpointStore

CheckpointStore is a type alias for crew.CheckpointStore.

type Crew

type Crew = crew.Crew

Crew is a type alias for crew.Crew.

type CrewConfig

type CrewConfig = crew.Config

CrewConfig is a type alias for crew.Config.

type CrewError

type CrewError = errors.CrewError

CrewError is a type alias for errors.CrewError.

type Criterion

type Criterion = eval.Criterion

Criterion is a type alias for eval.Criterion.

type DurationHistogram

type DurationHistogram = telemetry.DurationHistogram

DurationHistogram is a type alias for telemetry.DurationHistogram.

type EvalResult

type EvalResult = eval.Result

EvalResult is a type alias for eval.Result.

type EventBus

type EventBus = telemetry.EventBus

EventBus is a type alias for telemetry.EventBus.

type EventType

type EventType = telemetry.EventType

EventType is a type alias for telemetry.EventType.

type Flow

type Flow = flow.Flow

Flow is a type alias for flow.Flow.

type FlowEdge

type FlowEdge = flow.Edge

FlowEdge is a type alias for flow.Edge.

type FlowNode

type FlowNode = flow.Node

FlowNode is a type alias for flow.Node.

type FlowResult

type FlowResult = flow.Result

FlowResult is a type alias for flow.Result.

type GenerateOption

type GenerateOption = llm.GenerateOption

GenerateOption is a type alias for llm.GenerateOption.

type LLM

type LLM = llm.Client

LLM is a type alias for llm.Client.

type MemoryEntry

type MemoryEntry = memory.Entry

MemoryEntry is a type alias for memory.Entry.

type MemoryStore

type MemoryStore = memory.Store

MemoryStore is a type alias for memory.Store.

type Message

type Message = llm.Message

Message is a type alias for llm.Message.

type MetricsSnapshot

type MetricsSnapshot = telemetry.MetricsSnapshot

MetricsSnapshot is a type alias for telemetry.MetricsSnapshot.

type NodeState

type NodeState = crew.NodeState

NodeState is a type alias for crew.NodeState.

type OTELBridge

type OTELBridge = telemetry.OTELBridge

OTELBridge is a type alias for telemetry.OTELBridge.

type OutputCondition

type OutputCondition = flow.OutputCondition

OutputCondition is a type alias for flow.OutputCondition.

type Phase

type Phase = callback.Phase

Phase is a type alias for callback.Phase.

type ProcessType

type ProcessType = crew.ProcessType

ProcessType is a type alias for crew.ProcessType.

type Response

type Response = llm.Response

Response is a type alias for llm.Response.

type Result

type Result = crew.Result

Result is a type alias for crew.Result.

type StepInfo

type StepInfo = callback.StepInfo

StepInfo is a type alias for callback.StepInfo.

type StreamChunk

type StreamChunk = llm.StreamChunk

StreamChunk is a type alias for llm.StreamChunk.

type Task

type Task = task.Task

Task is a type alias for task.Task.

type TaskConfig

type TaskConfig = task.Config

TaskConfig is a type alias for task.Config.

type TelemetryEvent

type TelemetryEvent = telemetry.Event

TelemetryEvent is a type alias for telemetry.Event.

type TelemetryMetadata

type TelemetryMetadata = telemetry.Metadata

TelemetryMetadata is a type alias for telemetry.Metadata.

type Tool

type Tool = tools.Tool

Tool is a type alias for tools.Tool.

type ToolCall

type ToolCall = llm.ToolCall

ToolCall is a type alias for llm.ToolCall.

type ToolDef

type ToolDef = llm.ToolDef

ToolDef is a type alias for llm.ToolDef.

type Transport

type Transport = mcp.Transport

Transport is a type alias for mcp.Transport.

type Usage

type Usage = llm.Usage

Usage is a type alias for llm.Usage.

type YAMLEvalConfig

type YAMLEvalConfig = yamlconfig.EvalConfig

YAMLEvalConfig is a type alias for yamlconfig.EvalConfig.

type YAMLEvalCriterionConfig

type YAMLEvalCriterionConfig = yamlconfig.EvalCriterionConfig

YAMLEvalCriterionConfig is a type alias for yamlconfig.EvalCriterionConfig.

type YAMLLLMConfig

type YAMLLLMConfig = yamlconfig.LLMConfig

YAMLLLMConfig is a type alias for yamlconfig.LLMConfig.

type YAMLMCPServerConfig

type YAMLMCPServerConfig = yamlconfig.MCPServerConfig

YAMLMCPServerConfig is a type alias for yamlconfig.MCPServerConfig.

type YAMLMCPSetup

type YAMLMCPSetup = yamlconfig.MCPSetup

YAMLMCPSetup is a type alias for yamlconfig.MCPSetup.

Directories

Path Synopsis
examples
quickstart command
@sk-task foundation#T5.1: write quickstart example (AC-001, AC-015)
@sk-task foundation#T5.1: write quickstart example (AC-001, AC-015)
src
cmd/draftcrew command
@sk-task ecosystem#T1.2: CLI entrypoint with cobra + viper (AC-001, AC-002)
@sk-task ecosystem#T1.2: CLI entrypoint with cobra + viper (AC-001, AC-002)
eval
@sk-task ecosystem#T3.1: Eval package (contains, regex, llm_judge)
@sk-task ecosystem#T3.1: Eval package (contains, regex, llm_judge)
mcp
@sk-task ecosystem#T2.2: MCP client (connect, tools/list, tools/call)
@sk-task ecosystem#T2.2: MCP client (connect, tools/list, tools/call)
pkg/dashboard
@sk-task dashboard-polish#T1.1: Dashboard package with SSE handler + HTML (AC-001, AC-003)
@sk-task dashboard-polish#T1.1: Dashboard package with SSE handler + HTML (AC-001, AC-003)
pkg/llm
Package llm provides LLM provider abstractions for DraftCrew.
Package llm provides LLM provider abstractions for DraftCrew.
pkg/yamlconfig
@sk-task ecosystem#T1.1: YAML config parser (AC-001, AC-002, AC-010)
@sk-task ecosystem#T1.1: YAML config parser (AC-001, AC-002, AC-010)
telemetry module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL