skills/cylixlee/skills/eino-practices

eino-practices

SKILL.md

Eino Practices

CloudWeGo Eino is an AI application development framework for Go, providing capabilities for LLM invocation, component orchestration, and Agent development.

When to Use This Skill

Use this skill when:

  • You need to call large language models from Go
  • You need to build LLM-based applications
  • You need to define tools for LLM to call
  • You need to orchestrate multiple AI components into workflows
  • You need to develop Agent applications (ReAct, Multi-Agent, etc.)
  • You need to implement RAG (Retrieval Augmented Generation)
  • You need advanced features like state management, checkpoints, or callbacks

Core Concepts

Core components of the Eino framework:

Component Description Typical Use
ChatModel LLM wrapper Text generation, streaming
Prompt/ChatTemplate Prompt template Dynamic prompt building
Tool Tool definition External function calls by LLM
Retriever Vector retriever Knowledge retrieval for RAG
Lambda Custom function Data transformation, logic processing
Document Document parser PDF, Word, etc.
Embedding Text vectorizer Convert text to vectors
VectorStore Vector database Store and search vectors

Orchestration Patterns

Eino provides multiple orchestration patterns:

Pattern Description Use Case
Chain Sequential chaining Simple linear flows
Graph Directed Acyclic Graph (DAG) Complex flow control, conditional branches
Workflow Workflow Data flow with field mapping
Batch Batch processing Parallel/concurrent processing of inputs

Agent Types

Agent Type Description
ChatModelAgent Simple Agent based on ChatModel
ReAct Agent ReAct pattern with tool calling
Deep Agent Deep task orchestration with TODO
Supervisor Multi-Agent coordinator
Plan-Execute Plan-execute-replan pattern
Loop Agent Executes agents in a loop
Parallel Agent Executes multiple agents in parallel
Sequential Agent Executes agents sequentially

Advanced Features

Eino provides advanced features for complex applications:

  • State Management: Maintain state across node executions within a Graph
  • Checkpoint & Interruption: Pause and resume execution with state persistence
  • Callbacks/Tracing: Monitor and trace Graph/Workflow execution
  • Memory/Persistence: Store and retrieve conversation history
  • Human-in-the-Loop: Human approval, review, and feedback loops
  • Graph as Tool: Wrap Graph as reusable Tool in Agent

References

See the following files for detailed usage:

Core Components

Orchestration

Agent Development

Advanced Features

RAG

  • rag - RAG implementation guide

Best Practices

Key Packages

import (
    "github.com/cloudwego/eino/compose"
    "github.com/cloudwego/eino/flow/agent/react"
    "github.com/cloudwego/eino/schema"
    "github.com/cloudwego/eino/components/tool"
    "github.com/cloudwego/eino/components/prompt"
    "github.com/cloudwego/eino/components/embedding"
    "github.com/cloudwego/eino/components/retriever"
    "github.com/cloudwego/eino/adk"
    "github.com/cloudwego/eino/callbacks"
)

Best Practices

  1. Use interfaces over concrete types: Eino components implement common interfaces for easy swapping
  2. Leverage Graph/Workflow: Use orchestration for complex logic to keep code clean
  3. Define tools precisely: Clear ToolInfo descriptions help LLM call correctly
  4. Use streaming: Prefer Stream for conversation scenarios to improve UX
  5. Handle errors: Tool invocations need to handle JSON parsing errors and execution exceptions
  6. Use middleware: Leverage tool middleware (jsonfix, errorremover) for robustness
  7. Consider state management: Use state handlers when sharing data across nodes
  8. Implement checkpoints: For long-running flows requiring human intervention
  9. Apply rate limiting: Protect services from abuse with rate limiting middleware
  10. Cache responses: Use caching for expensive operations like LLM calls
  11. Use concurrency: Leverage Batch nodes and parallel execution for throughput
  12. Secure API keys: Never hardcode secrets; use environment variables or secret managers
Weekly Installs
1
Repository
cylixlee/skills
First Seen
8 days ago
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1