eino

package module
v0.9.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

Eino

coverage Release WebSite License Go Report Card OpenIssue ClosedIssue Stars Forks

English | 中文

Overview

Eino['aino] is an LLM application development framework in Golang. It draws from LangChain, Google ADK, and other open-source frameworks, and is designed to follow Golang conventions.

Eino provides:

  • Components: reusable building blocks like ChatModel, Tool, Retriever, and ChatTemplate, with official implementations for OpenAI, Ollama, and more.
  • Agent Development Kit (ADK): build AI agents with tool use, multi-agent coordination, context management, interrupt/resume for human-in-the-loop, and ready-to-use agent patterns.
  • Composition: connect components into graphs and workflows that can run standalone or be exposed as tools for agents.
  • Examples: working code for common patterns and real-world use cases.

Quick Start

ChatModelAgent

Configure a ChatModel, optionally add tools, and you have a working agent:

chatModel, _ := openai.NewChatModel(ctx, &openai.ChatModelConfig{
    Model:  "gpt-4o",
    APIKey: os.Getenv("OPENAI_API_KEY"),
})

agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
    Model: chatModel,
})

runner := adk.NewRunner(ctx, adk.RunnerConfig{Agent: agent})
iter := runner.Query(ctx, "Hello, who are you?")
for {
    event, ok := iter.Next()
    if !ok {
        break
    }
    fmt.Println(event.Message.Content)
}

Add tools to give the agent capabilities:

agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
    Model: chatModel,
    ToolsConfig: adk.ToolsConfig{
        ToolsNodeConfig: compose.ToolsNodeConfig{
            Tools: []tool.BaseTool{weatherTool, calculatorTool},
        },
    },
})

The agent handles the ReAct loop internally — it decides when to call tools and when to respond.

ChatModelAgent examples · docs

DeepAgent

For complex tasks, use DeepAgent. It breaks down problems into steps, delegates to sub-agents, and tracks progress:

deepAgent, _ := deep.New(ctx, &deep.Config{
    ChatModel: chatModel,
    SubAgents: []adk.Agent{researchAgent, codeAgent},
    ToolsConfig: adk.ToolsConfig{
        ToolsNodeConfig: compose.ToolsNodeConfig{
            Tools: []tool.BaseTool{shellTool, pythonTool, webSearchTool},
        },
    },
})

runner := adk.NewRunner(ctx, adk.RunnerConfig{Agent: deepAgent})
iter := runner.Query(ctx, "Analyze the sales data in report.csv and generate a summary chart")

DeepAgent can be configured to coordinate multiple specialized agents, run shell commands, execute Python code, and search the web.

DeepAgent example · docs

Composition

When you need precise control over execution flow, use compose to build graphs and workflows:

graph := compose.NewGraph[*Input, *Output]()
graph.AddLambdaNode("validate", validateFn)
graph.AddChatModelNode("generate", chatModel)
graph.AddLambdaNode("format", formatFn)

graph.AddEdge(compose.START, "validate")
graph.AddEdge("validate", "generate")
graph.AddEdge("generate", "format")
graph.AddEdge("format", compose.END)

runnable, _ := graph.Compile(ctx)
result, _ := runnable.Invoke(ctx, input)

Compositions can be exposed as tools for agents, bridging deterministic workflows with autonomous behavior:

tool, _ := graphtool.NewInvokableGraphTool(graph, "data_pipeline", "Process and validate data")

agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
    Model: chatModel,
    ToolsConfig: adk.ToolsConfig{
        ToolsNodeConfig: compose.ToolsNodeConfig{
            Tools: []tool.BaseTool{tool},
        },
    },
})

This lets you build domain-specific pipelines with exact control, then let agents decide when to use them.

GraphTool examples · compose docs

Key Features

Component Ecosystem

Eino defines component abstractions (ChatModel, Tool, Retriever, Embedding, etc.) with official implementations for OpenAI, Claude, Gemini, Ark, Ollama, Elasticsearch, and more.

eino-ext

Stream Processing

Eino automatically handles streaming throughout orchestration: concatenating, boxing, merging, and copying streams as data flows between nodes. Components only implement the streaming paradigms that make sense for them; the framework handles the rest.

docs

Callback Aspects

Inject logging, tracing, and metrics at fixed points (OnStart, OnEnd, OnError, OnStartWithStreamInput, OnEndWithStreamOutput) across components, graphs, and agents.

docs

Interrupt/Resume

Any agent or tool can pause execution for human input and resume from checkpoint. The framework handles state persistence and routing.

docs · examples

Framework Structure

The Eino framework consists of:

  • Eino (this repo): Type definitions, streaming mechanism, component abstractions, orchestration, agent implementations, aspect mechanisms

  • EinoExt: Component implementations, callback handlers, usage examples, evaluators, prompt optimizers

  • Eino Devops: Visualized development and debugging

  • EinoExamples: Example applications and best practices

Documentation

Dependencies

  • Go 1.18 and above.

Code Style

This repo uses golangci-lint. Check locally with:

golangci-lint run ./...

Rules enforced:

  • Exported functions, interfaces, packages, etc. should have GoDoc comments
  • Code should be formatted with gofmt -s
  • Import order should follow goimports (std -> third party -> local)

Security

If you discover a potential security issue, notify Bytedance Security via the security center or vulnerability reporting email.

Do not create a public GitHub issue.

Contact

    LarkGroup

License

This project is licensed under the Apache-2.0 License.

Documentation

Overview

Package eino provides building blocks for agent workflows, tools, and composable graph utilities.

Directories

Path Synopsis
adk
Package adk provides core agent development kit utilities and types.
Package adk provides core agent development kit utilities and types.
filesystem
Package filesystem provides file system operations.
Package filesystem provides file system operations.
internal
Package internal provides adk internal utils.
Package internal provides adk internal utils.
middlewares/dynamictool/toolsearch
Package toolsearch provides tool search middleware.
Package toolsearch provides tool search middleware.
middlewares/filesystem
Package filesystem provides middlewares.
Package filesystem provides middlewares.
middlewares/patchtoolcalls
Package patchtoolcalls provides a middleware that patches dangling tool calls in the message history.
Package patchtoolcalls provides a middleware that patches dangling tool calls in the message history.
middlewares/reduction
Package reduction provides middlewares to trim context and clear tool results.
Package reduction provides middlewares to trim context and clear tool results.
middlewares/reduction/internal
Package internal provides middlewares to trim context and clear tool results.
Package internal provides middlewares to trim context and clear tool results.
middlewares/skill
Package skill provides the skill middleware, types, and a local filesystem backend.
Package skill provides the skill middleware, types, and a local filesystem backend.
middlewares/summarization
Package summarization provides a middleware that automatically summarizes conversation history when token count exceeds the configured threshold.
Package summarization provides a middleware that automatically summarizes conversation history when token count exceeds the configured threshold.
prebuilt/deep
Package deep provides a prebuilt agent with deep task orchestration.
Package deep provides a prebuilt agent with deep task orchestration.
prebuilt/planexecute
Package planexecute implements a plan–execute–replan style agent.
Package planexecute implements a plan–execute–replan style agent.
prebuilt/supervisor
Package supervisor implements the supervisor pattern for multi-agent systems, where a central agent coordinates a set of sub-agents.
Package supervisor implements the supervisor pattern for multi-agent systems, where a central agent coordinates a set of sub-agents.
Package callbacks provides observability hooks for component execution in Eino.
Package callbacks provides observability hooks for component execution in Eino.
Package components defines common interfaces that describe component types and callback capabilities used across Eino.
Package components defines common interfaces that describe component types and callback capabilities used across Eino.
document
Package document defines the Loader and Transformer component interfaces for ingesting and processing documents in an eino pipeline.
Package document defines the Loader and Transformer component interfaces for ingesting and processing documents in an eino pipeline.
document/parser
Package parser defines the Parser interface for converting raw byte streams into schema.Document values.
Package parser defines the Parser interface for converting raw byte streams into schema.Document values.
embedding
Package embedding defines the Embedder component interface for converting text into vector representations.
Package embedding defines the Embedder component interface for converting text into vector representations.
indexer
Package indexer defines the Indexer component interface for storing documents and their vector representations in a backend store.
Package indexer defines the Indexer component interface for storing documents and their vector representations in a backend store.
model
Package model defines the ChatModel component interface for interacting with large language models (LLMs).
Package model defines the ChatModel component interface for interacting with large language models (LLMs).
prompt
Package prompt defines the ChatTemplate component interface for building structured message lists from templates and runtime variables.
Package prompt defines the ChatTemplate component interface for building structured message lists from templates and runtime variables.
retriever
Package retriever defines the Retriever component interface for fetching relevant documents from a document store given a query.
Package retriever defines the Retriever component interface for fetching relevant documents from a document store given a query.
tool
Package tool defines the tool component interfaces that allow language models to invoke external capabilities, and helpers for interrupt/resume within tools.
Package tool defines the tool component interfaces that allow language models to invoke external capabilities, and helpers for interrupt/resume within tools.
tool/utils
Package utils provides constructors for building tool implementations without writing boilerplate JSON serialization code.
Package utils provides constructors for building tool implementations without writing boilerplate JSON serialization code.
Package compose provides graph and workflow primitives to build composable, interruptible execution pipelines with callback support.
Package compose provides graph and workflow primitives to build composable, interruptible execution pipelines with callback support.
flow
agent
Package agent defines common option types used by agents and multi-agents.
Package agent defines common option types used by agents and multi-agents.
agent/multiagent/host
Package host implements the host pattern for multi-agent system.
Package host implements the host pattern for multi-agent system.
agent/react
Package react provides helpers to build callback handlers for React agents.
Package react provides helpers to build callback handlers for React agents.
indexer/parent
Package parent provides an indexer that assigns stable IDs to sub-documents and preserves relationships to their original parent document.
Package parent provides an indexer that assigns stable IDs to sub-documents and preserves relationships to their original parent document.
retriever/multiquery
Package multiquery implements a query-rewriting retriever that expands user queries into multiple variants to improve recall.
Package multiquery implements a query-rewriting retriever that expands user queries into multiple variants to improve recall.
retriever/parent
Package parent provides a retriever that maps sub-document results back to their original parent documents.
Package parent provides a retriever that maps sub-document results back to their original parent documents.
retriever/router
Package router provides retrieval routing helpers that merge results from multiple retrievers and apply ranking strategies.
Package router provides retrieval routing helpers that merge results from multiple retrievers and apply ranking strategies.
retriever/utils
Package utils provides helper utilities for retriever flows, including concurrent retrieval with callback instrumentation.
Package utils provides helper utilities for retriever flows, including concurrent retrieval with callback instrumentation.
mock
Package mock provides mock implementations for testing purposes.
Package mock provides mock implementations for testing purposes.
mock/adk
Package adk is a generated GoMock package.
Package adk is a generated GoMock package.
mock/components/document
Package document is a generated GoMock package.
Package document is a generated GoMock package.
mock/components/embedding
Package embedding is a generated GoMock package.
Package embedding is a generated GoMock package.
mock/components/indexer
Package indexer is a generated GoMock package.
Package indexer is a generated GoMock package.
mock/components/model
Package model is a generated GoMock package.
Package model is a generated GoMock package.
mock/components/retriever
Package retriever is a generated GoMock package.
Package retriever is a generated GoMock package.
Package schema defines the core data structures and utilities shared across all Eino components.
Package schema defines the core data structures and utilities shared across all Eino components.
claude
Package claude defines constants for claude.
Package claude defines constants for claude.
gemini
Package gemini defines the extension for gemini.
Package gemini defines the extension for gemini.
openai
Package openai defines constants for openai.
Package openai defines constants for openai.
utils
callbacks
Package callbacks provides ready-to-use callback handler templates for components.
Package callbacks provides ready-to-use callback handler templates for components.

Jump to

Keyboard shortcuts

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