The ultimate LLM/AI application development framework in Go.
| Files | Last commit | Last update |
|---|---|---|
feat: ChatModelAgentMiddleware, agent callbacks and language setting (#809) * refactor(adk): introduce AgentHandler interface for runtime agent customization (#660) * feat(adk): add callback support for ADK agents (#718) * feat: add enhanced tool support with multimodal output capabilities (#722) * feat: add enhanced tool support with multimodal output capabilities and improve message formatting This commit introduces enhanced tool interfaces that support structured multimodal outputs, enabling tools to return rich content beyond simple text responses. Key Changes: 1. New Enhanced Tool Interfaces: - Added EnhancedInvokableTool and EnhancedStreamableTool interfaces for multimodal tool execution - Both interfaces use ToolCallInfo as input and return ToolResult for structured output 2. ToolResult Schema: - Introduced ToolResult type to represent multimodal tool outputs - Supports multiple content types: text, image, audio, video, and file - Added ToolOutputPart with Index field for streaming chunk merging - Implemented ToMessageInputParts() for seamless model integration 3. ToolsNode Enhancements: - Extended ToolsNode to support both legacy and enhanced tool types - Added automatic conversion between invokable and streamable endpoints - Implemented middleware support for enhanced tools - Enhanced interrupt and rerun mechanism to handle ToolResult 4. React Agent Integration: - Introduce enhancedToolResultSender and enhancedStreamToolResultSender types - Support sending *schema.ToolResult with multimodal content (images, audio, video, files) - Implement EnhancedInvokable and EnhancedStreamable middleware in tool result collector 5. Message.String() Enhancement: - Add formatting support for UserInputMultiContent, AssistantGenMultiContent, and MultiContent - Implement formatInputPart, formatOutputPart, and formatChatMessagePart helper functions - Create mediaPartFormatter interface with wrapper types for unified media formatting 6. User Input Multi-Content Concatenation: - Implement concatUserMultiContent function for merging MessageInputPart slices - Support text and base64 audio merging with proper MIME type handling - Integrate into ConcatMessages function 7. Callback System: - Added CallbackInput and CallbackOutput types for tool callbacks - Implemented conversion functions for different callback input/output types 8. Comprehensive Test Coverage: - Added tests for enhanced invokable and streamable tools - Added TestMessageString with 14 test cases covering various message types Impact: - Enables tools to return rich multimodal content (images, audio, video, files) - Provides foundation for more sophisticated tool implementations - Maintains full backward compatibility with existing tool ecosystem * feat(schema): modify ToolArguments to ToolArgument (#732) * feat(adk): support tool search middleware (#725) * fix(adk): change ReturnDirectly type from map[string]struct{} to map[string]bool (#737) - Update ToolsConfig.ReturnDirectly type - Update ChatModelAgentContext.ReturnDirectly type - Update internal types: chatModelAgentExecCtx, execContext, reactConfig - Update all related function signatures - Update test files with new type syntax Change-Id: I7d819f1c44da91b76cf9a9f867a88008068153b8 * feat(adk): add Handlers field to deep.Config for ChatModelAgentMiddleware support (#738) * feat(adk): multiple API extensions related to middleware (#742) * refactor(adk): add error returns to wrap methods and ModelContext to AfterModelRewriteState (#745) * feat(adk): support chinese (#730) * feat(adk): add ChatModelAgentMiddleware constructors for filesystem and reduction packages (#749) * feat(adk): add summarization middleware (#729) * feat(adk): add plan task tool (#736) Change-Id: I61cd3709e78b5e1ef1fe169572913e7e35946d56 * feat(adk): add summarization middleware (#729) (#754) * feat(adk): tool reduction middleware (#746) * feat(adk): tool reduction middleware * refactor(adk): move ancient reduction middleware to internal package * chore(adk): reduction mw add i18n, rename TokenCounter * chore(adk): add reduction mw comments * chore(adk): refactor reduction mw config field, tool stream copy * feat(adk): Enhanced GrepRequest API by converting pointer parameters to value types and added extensive test suite for backend_inmemory GrepRaw implementation (#750) * feat(adk): enhance GrepRequest with value-type parameters and comprehensive test coverage Enhanced GrepRequest API by converting pointer parameters to value types and added extensive test suite for backend_inmemory GrepRaw implementation. Key Improvements: 1. GrepRequest Parameter Enhancement (backend.go): - Converted AfterLines, BeforeLines, ContextLines, HeadLimit, Offset from *int to int - Simplified parameter usage: direct value assignment instead of pointer references - Added clear semantics: values <= 0 indicate unset/default state - Improved API ergonomics and reduced boilerplate code 2. Backend_inmemory GrepRaw Support (backend_inmemory.go): - Updated parameter handling logic to support value-based parameters - Enhanced applyContext function with proper value validation (> 0 checks) - Improved applyPagination to handle int parameters correctly - Maintained backward compatibility while simplifying implementation 3. Middleware Integration (middlewares/filesystem/filesystem.go): - Added seamless pointer-to-value conversion for parameter passing - Implemented proper default value handling for HeadLimit and Offset - Ensured compatibility between middleware and backend layers 4. Comprehensive Test Suite (backend_inmemory_test.go): - Added 40+ table-driven test scenarios for GrepRaw functionality - Implemented concurrent safety tests (50 goroutines) - Added edge case tests (long lines, unicode, special characters) - Created detailed content validation tests - Added 4 performance benchmark tests - Included complete test coverage documentation Test Coverage: - All output modes: 100% (files_with_matches, content, count) - Parameter combinations: comprehensive coverage - Context lines: all combinations tested - Pagination: HeadLimit + Offset scenarios - Error handling: invalid patterns, boundary conditions - Concurrency: thread-safety verified - Performance: benchmarked common use cases Impact: - Simplified API: ContextLines: 1 instead of &contextLines - Better usability: no pointer variable creation needed - Enhanced reliability: comprehensive test coverage added - Improved maintainability: clear parameter semantics Files Changed: - adk/filesystem/backend.go: parameter type definitions - adk/filesystem/backend_inmemory.go: GrepRaw implementation - adk/filesystem/backend_inmemory_test.go: comprehensive test suite - adk/middlewares/filesystem/filesystem.go: middleware integration - adk/middlewares/filesystem/filesystem_test.go: test updates - adk/middlewares/filesystem/prompt.go: minor adjustments * feat(adk): add jsonschema descriptions to filesystem tool arguments Add detailed JSON Schema descriptions to all filesystem tool argument structs for better AI model understanding and tool invocation. Changes: - readFileArgs: Added descriptions for file_path, offset, and limit fields - writeFileArgs: Added descriptions for file_path and content fields - editFileArgs: Added descriptions for file_path, old_string, new_string, and replace_all fields with default value annotation - globArgs: Added descriptions for pattern and path fields - grepArgs: Added comprehensive descriptions for all 14 fields including pattern, path, glob, output_mode (with enum values), context options (-A/-B/-C), line numbers, case sensitivity, file type, pagination (head_limit/offset), and multiline mode Also updated tool descriptions in prompt.go: - WriteFileToolDesc: Improved usage guidelines with clearer instructions - GlobToolDesc: Simplified description focusing on key capabilities This enhancement enables LLM-based agents to better understand tool parameters and generate more accurate tool calls. * refactor(skill): replace LocalBackend with FilesystemBackend based on filesystem.Backend interface (#753) * fix(adk): add nil checks for execContext in ChatModelAgent Run and Resume (#758) * feat(skill): add context mode (fork/isolate) and model frontmatter support (#739) * feat(adk): optimize filesystem (#751) * feat(adk): support patch tool calls middleware (#756) * feat(adk): add ModelOptions config for summarization middleware (#763) * refactor(adk): rename constructors to New() for ChatModelAgentMiddleware (#761) * refactor(adk): refactor tool reduction middleware (#762) * refactor(adk): refactor tool reduction middleware * refactor(adk): flatten reducton middleware configs, remove redundant parts * refactor(adk): modify truncation / clear replacement message * feat(adk): align filesystem backend FileInfo.Path field behavior with Python glob and ls command (#767) * feat(adk): improve summarization middleware user messages truncation (#769) * feat: add enhanced tool support with multimodal output capabilities (#722) * feat: add enhanced tool support with multimodal output capabilities and improve message formatting This commit introduces enhanced tool interfaces that support structured multimodal outputs, enabling tools to return rich content beyond simple text responses. Key Changes: 1. New Enhanced Tool Interfaces: - Added EnhancedInvokableTool and EnhancedStreamableTool interfaces for multimodal tool execution - Both interfaces use ToolCallInfo as input and return ToolResult for structured output 2. ToolResult Schema: - Introduced ToolResult type to represent multimodal tool outputs - Supports multiple content types: text, image, audio, video, and file - Added ToolOutputPart with Index field for streaming chunk merging - Implemented ToMessageInputParts() for seamless model integration 3. ToolsNode Enhancements: - Extended ToolsNode to support both legacy and enhanced tool types - Added automatic conversion between invokable and streamable endpoints - Implemented middleware support for enhanced tools - Enhanced interrupt and rerun mechanism to handle ToolResult 4. React Agent Integration: - Introduce enhancedToolResultSender and enhancedStreamToolResultSender types - Support sending *schema.ToolResult with multimodal content (images, audio, video, files) - Implement EnhancedInvokable and EnhancedStreamable middleware in tool result collector 5. Message.String() Enhancement: - Add formatting support for UserInputMultiContent, AssistantGenMultiContent, and MultiContent - Implement formatInputPart, formatOutputPart, and formatChatMessagePart helper functions - Create mediaPartFormatter interface with wrapper types for unified media formatting 6. User Input Multi-Content Concatenation: - Implement concatUserMultiContent function for merging MessageInputPart slices - Support text and base64 audio merging with proper MIME type handling - Integrate into ConcatMessages function 7. Callback System: - Added CallbackInput and CallbackOutput types for tool callbacks - Implemented conversion functions for different callback input/output types 8. Comprehensive Test Coverage: - Added tests for enhanced invokable and streamable tools - Added TestMessageString with 14 test cases covering various message types Impact: - Enables tools to return rich multimodal content (images, audio, video, files) - Provides foundation for more sophisticated tool implementations - Maintains full backward compatibility with existing tool ecosystem * feat(adk): improve summarization prompt (#774) * fix(adk): fix concurrent compile race in ChatModelAgent (#775) Move chain and inner graph creation inside closures to avoid data races when multiple requests call Compile() concurrently on shared instances. Changes: - buildNoToolsRunFunc: create chain per request instead of sharing - buildReactRunFunc: create both inner graph (g) and chain per request Change-Id: I9a44697675c892ac7658909010b72d3a2718c25a * fix: Optimize consistency between task file and high watermark file w… (#778) fix: Optimize consistency between task file and high watermark file writes Change-Id: Ie15df63166caab889222323d1adbb1ab61f5de2d * feat(adk): optimize comment (#781) * feat(adk): optimize set language (#783) feat(adk): optimize language * feat(adk): optimize summarize prompt (#784) * feat(adk): remove large tool result offloading from filesystem middle… (#785) * refactor(filesystem): define exported constants for tool names (#787) - Add exported constants (ToolNameLs, ToolNameReadFile, ToolNameWriteFile, ToolNameEditFile, ToolNameGlob, ToolNameGrep, ToolNameExecute) - Replace hardcoded tool name strings with constants throughout the file - Improve code maintainability and prevent typos * refactor(adk): simplify tool reduction config, add truncation handler (#776) * feat: add Prepare configuration for summarization middleware (#779) * feat: add PreserveUserMessages.MaxTokens config for summarization (#788) * feat(adk): enhance filesystem backend with comprehensive grep improvements and test coverage (#777) Major enhancements to the filesystem backend module with focus on GrepRaw functionality: **Core Improvements:** - Implemented concurrent file processing using worker pool pattern (max 10 workers) - Added panic recovery mechanism in goroutines with proper error propagation - Refactored file filtering strategy: sequential glob → file type filtering for better performance - Enhanced multiline pattern matching to return complete original file lines instead of partial matches - Upgraded glob pattern matching from filepath.Match to doublestar/v4 for recursive pattern support **API Simplifications:** - Removed OutputMode, ContextLines, HeadLimit, and Offset parameters from GrepRequest - Streamlined API surface while maintaining core functionality - Kept BeforeLines and AfterLines for context display **Testing:** - Added comprehensive unit tests for GrepRaw covering 35+ scenarios - Added benchmark tests for performance validation - Added concurrent operation safety tests - Achieved complete coverage of edge cases and error conditions **Technical Details:** - Worker pool dynamically adjusts between 1-10 workers based on file count - Single file operations bypass parallelism to avoid overhead - Glob patterns now support "**/*.go" recursive matching and "src/**/*.go" path prefixes - Multiline matches return full line content including post-match text on the same line **Performance Impact:** - 10x speedup for 100+ file searches with parallel processing - Optimized filter pipeline reduces redundant file checks - Memory-efficient channel-based result collection * fix: fix Chinese translation for transcript path instruction (#798) * feat(adk): rename patchtoolcall middleware (#799) * chore: align default clear offload handler dir with trunc (#805) * refactor(adk): improve grep parameter naming and remove unused types (#803) * refactor(adk): remove isMethodOverridden optimization logic (#807) * fix: skip clear tool without result (#808) * feat(adk): deepagents support default filesystem tools (#810) * feat: improve summarization prompt (#817) * feat: add custom tool name support for filesystem middleware tools (#819) Added the ability to customize tool names for all filesystem middleware tools, allowing users to override default tool names with their own naming conventions. Main changes: - Added CustomXXXToolName fields to Config and MiddlewareConfig structs for all 7 tools (ls, read_file, write_file, edit_file, glob, grep, execute) - Implemented selectToolName() helper function to handle custom name selection with fallback to defaults - Updated all tool creation functions (newLsTool, newReadFileTool, newWriteFileTool, newEditFileTool, newGlobTool, newGrepTool, newExecuteTool, newStreamingExecuteTool) to accept name parameter - Modified getFilesystemTools() to pass custom tool names to each tool creation function - Updated NewMiddleware() to forward custom tool name configurations Implementation details: - Custom tool names are optional pointer fields, maintaining backward compatibility - When CustomXXXToolName is nil, default constants from ToolNameXXX are used - selectToolName() provides centralized logic for name resolution - All 7 filesystem tools now support name customization: ls, read_file, write_file, edit_file, glob, grep, and execute Benefits: - Enables alignment with organization-specific naming conventions - Allows shorter or more intuitive names for specific use cases - Prevents naming conflicts with other tools in the system - Maintains full backward compatibility with existing code * feat(adk): support customizing skill sp&description (#820) * feat(adk): improve filesystem tools empty result handling (#821) * feat(adk): remove absolute desc in filesystem tool fields' desc (#822) * fix(adk): restore HasReturnDirectly field for backward compatibility (#823) * chore: upgrade sonic to v1.15.0 for go 1.26 support (#829) Closes #801 * feat(adk): add custom tool support for filesystem middleware (#824) * refactor(adk): refactor filesystem middleware tool configuration with custom tools and disable flags - Add support for custom tool implementations via ToolConfig - Add Disabled flag to allow disabling individual tools - Change Name and Desc fields from *string to string for better usability - Merge tool configuration logic with legacy descriptor fields - Improve code organization and field ordering in ToolConfig~ * refactor: optimize code structure, add edge case tests and improve documentation - Extract validateConfigCore to eliminate duplicate validation logic - Refactor getFilesystemTools using toolSpec pattern to reduce repetition - Add comprehensive edge case tests for ToolConfig: * Empty Desc with nil legacyDesc * CustomTool with Disabled flag * Multiple conflicting configurations * Nil config fallback scenarios * Empty Name/Desc defaults - Clarify CustomTool comment to mention Backend-associated implementation * docs: add documentation comments for toolSpec and createToolFromSpec - Add comprehensive comment for toolSpec structure explaining its purpose - Add detailed comment for createToolFromSpec function describing its workflow - Improve code readability and maintainability through better documentation * refactor: change Desc field back to *string pointer type - Change ToolConfig.Desc from string to *string for better optionality - Update mergeToolConfigWithDesc to handle nil pointer checks - Update createToolFromSpec to convert *string to string when calling createFunc - Update all related tests to use pointer types for Desc field - Keep Name field as string type (non-pointer) * refactor: remove ExecuteToolConfig configuration - Remove ExecuteToolConfig from Config and MiddlewareConfig structs - Execute tool is now automatically created based on Shell/StreamingShell availability - Remove ExecuteToolConfig from validation logic - Remove ExecuteToolConfig from toolSpecs array - Add standalone execute tool creation logic after toolSpecs loop - Remove related test cases - Simplify execute tool configuration by using default name and description * refactor(filesystem): optimize the verification logic (#836) feat(adk): optimize the verification logic * fix(adk): prevent duplicate callback invocations in workflow agents (#831) * feat(adk): define GenModelInput config for summarization middleware (#833) * feat: optimize type name (#839) * test: add reduction mw ut (#841) * refactor(filesystem): remove hardcoded system prompts and add streaming shell tests (#842) Remove the default system prompt injection logic from NewMiddleware and New, keeping only custom prompt support. Delete unused ToolsSystemPrompt and ExecuteToolsSystemPrompt constants from prompt.go. Add comprehensive test coverage for streaming shell execution, validation, and edge cases. * feat(adk): remove sp of write_todos (#838) * refactor(skill): simplify AgentHub interface and improve test coverage (#849) * refactor(filesystem): optimize Read to return FileContent and avoid allocations (#850) - Change Backend.Read return type from string to FileContent struct for extensibility - Optimize InMemoryBackend.Read to use strings.IndexByte scanning instead of strings.Split/Join, eliminating unnecessary allocations for large files - Add fast path for the common case (no offset, content within limit) - Fix default limit from 200 to 2000 to match ReadRequest documentation - Fix offset to be strictly 1-based as documented in ReadRequest - Move line number formatting from backend to middleware layer (separation of concerns) - Add comprehensive Read edge case tests * chore: update gitignore Change-Id: Ia71dc2f76902414750772b8be0a413c7f7d1d2db --------- Co-authored-by: Zhj <zhuangjie.1125@bytedance.com> Co-authored-by: Megumin <wangdezheng@bytedance.com> Co-authored-by: mrh997 <maronghong@bytedance.com> Co-authored-by: Ryo <fanlvlgh@gmail.com> Co-authored-by: N3ko <xuzhaonan@bytedance.com> Co-authored-by: IPender <lipandeng@bytedance.com> | 6 months ago | |
feat(adk): add PatchedToolResultGenerator for EnhancedTool-style results (#1168) | 30 days ago | |
feat: add dev and AI setup scripts (#856) Adds setup tooling to make cross-repo development and AI-assisted usage of Eino easier: scripts/dev_setup.sh: clones eino-ext and eino-examples under this repo and generates a gitignored go.work for full cross-module LSP (go-to-definition, type info, autocomplete). scripts/eino_setup.sh: for downstream projects, clones eino + eino-ext + eino-examples into a gitignored _eino/ reference directory so AI assistants can browse framework source and examples. Also: Adds llms.txt for AI tooling discoverability. Enriches GoDoc across components/, schema/, and callbacks/ to align with the official docs and improve in-editor guidance. Updates .gitignore to avoid accidentally committing local/AI setup artifacts. Motivation Working across eino / eino-ext / eino-examples currently requires manual cloning and editor setup. Editors and AI tools often lack cross-module navigation, which slows iteration and can lead to incorrect wiring. Design Notes dev_setup.sh uses .git/info/exclude so ext/ and examples/ stay local-only without changing the public repo’s tracked files. eino_setup.sh uses _eino/ (gitignored) so downstream repos keep normal go.mod dependencies while still giving assistants full source context. Package-level documentation is centralized in doc.go files to satisfy linting rules. | 5 months ago | |
feat(components): support call-time index option (#1047) | 3 months ago | |
fix(compose): avoid racing time.After(0) against task completion on immediate graph interrupt (#1149) | 1 month ago | |
fix(flow): prevent panic in WithMessageFuture when agent is used in nested graphs (#828) | 5 months ago | |
fix(serialization): fix ToolInfo.ParamsOneOf loss during checkpoint deep-copy (#1007) fix(serialization): ensure pointer-receiver MarshalJSON is invoked in InternalSerializer When InternalSerializer marshals a struct value that implements json.Marshaler via pointer receiver (e.g. *ToolInfo), rv.Interface() produces a non-addressable copy. json.Marshal then cannot call the pointer method and falls back to default struct encoding, which skips unexported fields — causing ParamsOneOf data loss after deepCopyState during interrupt/resume. Fix: pass a pointer to json.Marshal by using rv.Addr() when addressable, or copying into reflect.New() otherwise. | 3 months ago | |
fix(schema): gonja ssti (#1077) | 2 months ago | |
feat: add dev and AI setup scripts (#856) Adds setup tooling to make cross-repo development and AI-assisted usage of Eino easier: scripts/dev_setup.sh: clones eino-ext and eino-examples under this repo and generates a gitignored go.work for full cross-module LSP (go-to-definition, type info, autocomplete). scripts/eino_setup.sh: for downstream projects, clones eino + eino-ext + eino-examples into a gitignored _eino/ reference directory so AI assistants can browse framework source and examples. Also: Adds llms.txt for AI tooling discoverability. Enriches GoDoc across components/, schema/, and callbacks/ to align with the official docs and improve in-editor guidance. Updates .gitignore to avoid accidentally committing local/AI setup artifacts. Motivation Working across eino / eino-ext / eino-examples currently requires manual cloning and editor setup. Editors and AI tools often lack cross-module navigation, which slows iteration and can lead to incorrect wiring. Design Notes dev_setup.sh uses .git/info/exclude so ext/ and examples/ stay local-only without changing the public repo’s tracked files. eino_setup.sh uses _eino/ (gitignored) so downstream repos keep normal go.mod dependencies while still giving assistants full source context. Package-level documentation is centralized in doc.go files to satisfy linting rules. | 5 months ago | |
feat(adk): integrate AgenticMessage into ADK (#920) | 3 months ago | |
fix(adk): propagate missing ToolsNodeConfig fields in ChatModelAgent (#945) - Add ToolAliases to prepareExecContext when building ToolsNodeConfig - Add UnknownToolsHandler, ExecuteSequentially, ToolArgumentsHandler, and ToolAliases to applyBeforeAgent when rebuilding after BeforeAgent handlers modify tools - Add tests covering argument alias remapping, name alias dispatch, alias preservation after handler rebuild, and handler-only tool registration with pre-configured aliases | 3 months ago | |
fix(adk): propagate missing ToolsNodeConfig fields in ChatModelAgent (#945) - Add ToolAliases to prepareExecContext when building ToolsNodeConfig - Add UnknownToolsHandler, ExecuteSequentially, ToolArgumentsHandler, and ToolAliases to applyBeforeAgent when rebuilding after BeforeAgent handlers modify tools - Add tests covering argument alias remapping, name alias dispatch, alias preservation after handler rebuild, and handler-only tool registration with pre-configured aliases | 3 months ago | |
refactor: streamline summarization finalizers (#1054) | 3 months ago | |
feat(ci): enable golangci-lint (#602) | 8 months ago | |
feat(ci): enable golangci-lint (#602) | 8 months ago | |
Initial commit | 1 year ago | |
Initial commit | 1 year ago | |
Initial commit | 1 year ago | |
docs: fix vulnerability reporting email link (#519) | 5 months ago | |
docs: fix vulnerability reporting email link (#519) | 5 months ago | |
feat: ChatModelAgentMiddleware, agent callbacks and language setting (#809) * refactor(adk): introduce AgentHandler interface for runtime agent customization (#660) * feat(adk): add callback support for ADK agents (#718) * feat: add enhanced tool support with multimodal output capabilities (#722) * feat: add enhanced tool support with multimodal output capabilities and improve message formatting This commit introduces enhanced tool interfaces that support structured multimodal outputs, enabling tools to return rich content beyond simple text responses. Key Changes: 1. New Enhanced Tool Interfaces: - Added EnhancedInvokableTool and EnhancedStreamableTool interfaces for multimodal tool execution - Both interfaces use ToolCallInfo as input and return ToolResult for structured output 2. ToolResult Schema: - Introduced ToolResult type to represent multimodal tool outputs - Supports multiple content types: text, image, audio, video, and file - Added ToolOutputPart with Index field for streaming chunk merging - Implemented ToMessageInputParts() for seamless model integration 3. ToolsNode Enhancements: - Extended ToolsNode to support both legacy and enhanced tool types - Added automatic conversion between invokable and streamable endpoints - Implemented middleware support for enhanced tools - Enhanced interrupt and rerun mechanism to handle ToolResult 4. React Agent Integration: - Introduce enhancedToolResultSender and enhancedStreamToolResultSender types - Support sending *schema.ToolResult with multimodal content (images, audio, video, files) - Implement EnhancedInvokable and EnhancedStreamable middleware in tool result collector 5. Message.String() Enhancement: - Add formatting support for UserInputMultiContent, AssistantGenMultiContent, and MultiContent - Implement formatInputPart, formatOutputPart, and formatChatMessagePart helper functions - Create mediaPartFormatter interface with wrapper types for unified media formatting 6. User Input Multi-Content Concatenation: - Implement concatUserMultiContent function for merging MessageInputPart slices - Support text and base64 audio merging with proper MIME type handling - Integrate into ConcatMessages function 7. Callback System: - Added CallbackInput and CallbackOutput types for tool callbacks - Implemented conversion functions for different callback input/output types 8. Comprehensive Test Coverage: - Added tests for enhanced invokable and streamable tools - Added TestMessageString with 14 test cases covering various message types Impact: - Enables tools to return rich multimodal content (images, audio, video, files) - Provides foundation for more sophisticated tool implementations - Maintains full backward compatibility with existing tool ecosystem * feat(schema): modify ToolArguments to ToolArgument (#732) * feat(adk): support tool search middleware (#725) * fix(adk): change ReturnDirectly type from map[string]struct{} to map[string]bool (#737) - Update ToolsConfig.ReturnDirectly type - Update ChatModelAgentContext.ReturnDirectly type - Update internal types: chatModelAgentExecCtx, execContext, reactConfig - Update all related function signatures - Update test files with new type syntax Change-Id: I7d819f1c44da91b76cf9a9f867a88008068153b8 * feat(adk): add Handlers field to deep.Config for ChatModelAgentMiddleware support (#738) * feat(adk): multiple API extensions related to middleware (#742) * refactor(adk): add error returns to wrap methods and ModelContext to AfterModelRewriteState (#745) * feat(adk): support chinese (#730) * feat(adk): add ChatModelAgentMiddleware constructors for filesystem and reduction packages (#749) * feat(adk): add summarization middleware (#729) * feat(adk): add plan task tool (#736) Change-Id: I61cd3709e78b5e1ef1fe169572913e7e35946d56 * feat(adk): add summarization middleware (#729) (#754) * feat(adk): tool reduction middleware (#746) * feat(adk): tool reduction middleware * refactor(adk): move ancient reduction middleware to internal package * chore(adk): reduction mw add i18n, rename TokenCounter * chore(adk): add reduction mw comments * chore(adk): refactor reduction mw config field, tool stream copy * feat(adk): Enhanced GrepRequest API by converting pointer parameters to value types and added extensive test suite for backend_inmemory GrepRaw implementation (#750) * feat(adk): enhance GrepRequest with value-type parameters and comprehensive test coverage Enhanced GrepRequest API by converting pointer parameters to value types and added extensive test suite for backend_inmemory GrepRaw implementation. Key Improvements: 1. GrepRequest Parameter Enhancement (backend.go): - Converted AfterLines, BeforeLines, ContextLines, HeadLimit, Offset from *int to int - Simplified parameter usage: direct value assignment instead of pointer references - Added clear semantics: values <= 0 indicate unset/default state - Improved API ergonomics and reduced boilerplate code 2. Backend_inmemory GrepRaw Support (backend_inmemory.go): - Updated parameter handling logic to support value-based parameters - Enhanced applyContext function with proper value validation (> 0 checks) - Improved applyPagination to handle int parameters correctly - Maintained backward compatibility while simplifying implementation 3. Middleware Integration (middlewares/filesystem/filesystem.go): - Added seamless pointer-to-value conversion for parameter passing - Implemented proper default value handling for HeadLimit and Offset - Ensured compatibility between middleware and backend layers 4. Comprehensive Test Suite (backend_inmemory_test.go): - Added 40+ table-driven test scenarios for GrepRaw functionality - Implemented concurrent safety tests (50 goroutines) - Added edge case tests (long lines, unicode, special characters) - Created detailed content validation tests - Added 4 performance benchmark tests - Included complete test coverage documentation Test Coverage: - All output modes: 100% (files_with_matches, content, count) - Parameter combinations: comprehensive coverage - Context lines: all combinations tested - Pagination: HeadLimit + Offset scenarios - Error handling: invalid patterns, boundary conditions - Concurrency: thread-safety verified - Performance: benchmarked common use cases Impact: - Simplified API: ContextLines: 1 instead of &contextLines - Better usability: no pointer variable creation needed - Enhanced reliability: comprehensive test coverage added - Improved maintainability: clear parameter semantics Files Changed: - adk/filesystem/backend.go: parameter type definitions - adk/filesystem/backend_inmemory.go: GrepRaw implementation - adk/filesystem/backend_inmemory_test.go: comprehensive test suite - adk/middlewares/filesystem/filesystem.go: middleware integration - adk/middlewares/filesystem/filesystem_test.go: test updates - adk/middlewares/filesystem/prompt.go: minor adjustments * feat(adk): add jsonschema descriptions to filesystem tool arguments Add detailed JSON Schema descriptions to all filesystem tool argument structs for better AI model understanding and tool invocation. Changes: - readFileArgs: Added descriptions for file_path, offset, and limit fields - writeFileArgs: Added descriptions for file_path and content fields - editFileArgs: Added descriptions for file_path, old_string, new_string, and replace_all fields with default value annotation - globArgs: Added descriptions for pattern and path fields - grepArgs: Added comprehensive descriptions for all 14 fields including pattern, path, glob, output_mode (with enum values), context options (-A/-B/-C), line numbers, case sensitivity, file type, pagination (head_limit/offset), and multiline mode Also updated tool descriptions in prompt.go: - WriteFileToolDesc: Improved usage guidelines with clearer instructions - GlobToolDesc: Simplified description focusing on key capabilities This enhancement enables LLM-based agents to better understand tool parameters and generate more accurate tool calls. * refactor(skill): replace LocalBackend with FilesystemBackend based on filesystem.Backend interface (#753) * fix(adk): add nil checks for execContext in ChatModelAgent Run and Resume (#758) * feat(skill): add context mode (fork/isolate) and model frontmatter support (#739) * feat(adk): optimize filesystem (#751) * feat(adk): support patch tool calls middleware (#756) * feat(adk): add ModelOptions config for summarization middleware (#763) * refactor(adk): rename constructors to New() for ChatModelAgentMiddleware (#761) * refactor(adk): refactor tool reduction middleware (#762) * refactor(adk): refactor tool reduction middleware * refactor(adk): flatten reducton middleware configs, remove redundant parts * refactor(adk): modify truncation / clear replacement message * feat(adk): align filesystem backend FileInfo.Path field behavior with Python glob and ls command (#767) * feat(adk): improve summarization middleware user messages truncation (#769) * feat: add enhanced tool support with multimodal output capabilities (#722) * feat: add enhanced tool support with multimodal output capabilities and improve message formatting This commit introduces enhanced tool interfaces that support structured multimodal outputs, enabling tools to return rich content beyond simple text responses. Key Changes: 1. New Enhanced Tool Interfaces: - Added EnhancedInvokableTool and EnhancedStreamableTool interfaces for multimodal tool execution - Both interfaces use ToolCallInfo as input and return ToolResult for structured output 2. ToolResult Schema: - Introduced ToolResult type to represent multimodal tool outputs - Supports multiple content types: text, image, audio, video, and file - Added ToolOutputPart with Index field for streaming chunk merging - Implemented ToMessageInputParts() for seamless model integration 3. ToolsNode Enhancements: - Extended ToolsNode to support both legacy and enhanced tool types - Added automatic conversion between invokable and streamable endpoints - Implemented middleware support for enhanced tools - Enhanced interrupt and rerun mechanism to handle ToolResult 4. React Agent Integration: - Introduce enhancedToolResultSender and enhancedStreamToolResultSender types - Support sending *schema.ToolResult with multimodal content (images, audio, video, files) - Implement EnhancedInvokable and EnhancedStreamable middleware in tool result collector 5. Message.String() Enhancement: - Add formatting support for UserInputMultiContent, AssistantGenMultiContent, and MultiContent - Implement formatInputPart, formatOutputPart, and formatChatMessagePart helper functions - Create mediaPartFormatter interface with wrapper types for unified media formatting 6. User Input Multi-Content Concatenation: - Implement concatUserMultiContent function for merging MessageInputPart slices - Support text and base64 audio merging with proper MIME type handling - Integrate into ConcatMessages function 7. Callback System: - Added CallbackInput and CallbackOutput types for tool callbacks - Implemented conversion functions for different callback input/output types 8. Comprehensive Test Coverage: - Added tests for enhanced invokable and streamable tools - Added TestMessageString with 14 test cases covering various message types Impact: - Enables tools to return rich multimodal content (images, audio, video, files) - Provides foundation for more sophisticated tool implementations - Maintains full backward compatibility with existing tool ecosystem * feat(adk): improve summarization prompt (#774) * fix(adk): fix concurrent compile race in ChatModelAgent (#775) Move chain and inner graph creation inside closures to avoid data races when multiple requests call Compile() concurrently on shared instances. Changes: - buildNoToolsRunFunc: create chain per request instead of sharing - buildReactRunFunc: create both inner graph (g) and chain per request Change-Id: I9a44697675c892ac7658909010b72d3a2718c25a * fix: Optimize consistency between task file and high watermark file w… (#778) fix: Optimize consistency between task file and high watermark file writes Change-Id: Ie15df63166caab889222323d1adbb1ab61f5de2d * feat(adk): optimize comment (#781) * feat(adk): optimize set language (#783) feat(adk): optimize language * feat(adk): optimize summarize prompt (#784) * feat(adk): remove large tool result offloading from filesystem middle… (#785) * refactor(filesystem): define exported constants for tool names (#787) - Add exported constants (ToolNameLs, ToolNameReadFile, ToolNameWriteFile, ToolNameEditFile, ToolNameGlob, ToolNameGrep, ToolNameExecute) - Replace hardcoded tool name strings with constants throughout the file - Improve code maintainability and prevent typos * refactor(adk): simplify tool reduction config, add truncation handler (#776) * feat: add Prepare configuration for summarization middleware (#779) * feat: add PreserveUserMessages.MaxTokens config for summarization (#788) * feat(adk): enhance filesystem backend with comprehensive grep improvements and test coverage (#777) Major enhancements to the filesystem backend module with focus on GrepRaw functionality: **Core Improvements:** - Implemented concurrent file processing using worker pool pattern (max 10 workers) - Added panic recovery mechanism in goroutines with proper error propagation - Refactored file filtering strategy: sequential glob → file type filtering for better performance - Enhanced multiline pattern matching to return complete original file lines instead of partial matches - Upgraded glob pattern matching from filepath.Match to doublestar/v4 for recursive pattern support **API Simplifications:** - Removed OutputMode, ContextLines, HeadLimit, and Offset parameters from GrepRequest - Streamlined API surface while maintaining core functionality - Kept BeforeLines and AfterLines for context display **Testing:** - Added comprehensive unit tests for GrepRaw covering 35+ scenarios - Added benchmark tests for performance validation - Added concurrent operation safety tests - Achieved complete coverage of edge cases and error conditions **Technical Details:** - Worker pool dynamically adjusts between 1-10 workers based on file count - Single file operations bypass parallelism to avoid overhead - Glob patterns now support "**/*.go" recursive matching and "src/**/*.go" path prefixes - Multiline matches return full line content including post-match text on the same line **Performance Impact:** - 10x speedup for 100+ file searches with parallel processing - Optimized filter pipeline reduces redundant file checks - Memory-efficient channel-based result collection * fix: fix Chinese translation for transcript path instruction (#798) * feat(adk): rename patchtoolcall middleware (#799) * chore: align default clear offload handler dir with trunc (#805) * refactor(adk): improve grep parameter naming and remove unused types (#803) * refactor(adk): remove isMethodOverridden optimization logic (#807) * fix: skip clear tool without result (#808) * feat(adk): deepagents support default filesystem tools (#810) * feat: improve summarization prompt (#817) * feat: add custom tool name support for filesystem middleware tools (#819) Added the ability to customize tool names for all filesystem middleware tools, allowing users to override default tool names with their own naming conventions. Main changes: - Added CustomXXXToolName fields to Config and MiddlewareConfig structs for all 7 tools (ls, read_file, write_file, edit_file, glob, grep, execute) - Implemented selectToolName() helper function to handle custom name selection with fallback to defaults - Updated all tool creation functions (newLsTool, newReadFileTool, newWriteFileTool, newEditFileTool, newGlobTool, newGrepTool, newExecuteTool, newStreamingExecuteTool) to accept name parameter - Modified getFilesystemTools() to pass custom tool names to each tool creation function - Updated NewMiddleware() to forward custom tool name configurations Implementation details: - Custom tool names are optional pointer fields, maintaining backward compatibility - When CustomXXXToolName is nil, default constants from ToolNameXXX are used - selectToolName() provides centralized logic for name resolution - All 7 filesystem tools now support name customization: ls, read_file, write_file, edit_file, glob, grep, and execute Benefits: - Enables alignment with organization-specific naming conventions - Allows shorter or more intuitive names for specific use cases - Prevents naming conflicts with other tools in the system - Maintains full backward compatibility with existing code * feat(adk): support customizing skill sp&description (#820) * feat(adk): improve filesystem tools empty result handling (#821) * feat(adk): remove absolute desc in filesystem tool fields' desc (#822) * fix(adk): restore HasReturnDirectly field for backward compatibility (#823) * chore: upgrade sonic to v1.15.0 for go 1.26 support (#829) Closes #801 * feat(adk): add custom tool support for filesystem middleware (#824) * refactor(adk): refactor filesystem middleware tool configuration with custom tools and disable flags - Add support for custom tool implementations via ToolConfig - Add Disabled flag to allow disabling individual tools - Change Name and Desc fields from *string to string for better usability - Merge tool configuration logic with legacy descriptor fields - Improve code organization and field ordering in ToolConfig~ * refactor: optimize code structure, add edge case tests and improve documentation - Extract validateConfigCore to eliminate duplicate validation logic - Refactor getFilesystemTools using toolSpec pattern to reduce repetition - Add comprehensive edge case tests for ToolConfig: * Empty Desc with nil legacyDesc * CustomTool with Disabled flag * Multiple conflicting configurations * Nil config fallback scenarios * Empty Name/Desc defaults - Clarify CustomTool comment to mention Backend-associated implementation * docs: add documentation comments for toolSpec and createToolFromSpec - Add comprehensive comment for toolSpec structure explaining its purpose - Add detailed comment for createToolFromSpec function describing its workflow - Improve code readability and maintainability through better documentation * refactor: change Desc field back to *string pointer type - Change ToolConfig.Desc from string to *string for better optionality - Update mergeToolConfigWithDesc to handle nil pointer checks - Update createToolFromSpec to convert *string to string when calling createFunc - Update all related tests to use pointer types for Desc field - Keep Name field as string type (non-pointer) * refactor: remove ExecuteToolConfig configuration - Remove ExecuteToolConfig from Config and MiddlewareConfig structs - Execute tool is now automatically created based on Shell/StreamingShell availability - Remove ExecuteToolConfig from validation logic - Remove ExecuteToolConfig from toolSpecs array - Add standalone execute tool creation logic after toolSpecs loop - Remove related test cases - Simplify execute tool configuration by using default name and description * refactor(filesystem): optimize the verification logic (#836) feat(adk): optimize the verification logic * fix(adk): prevent duplicate callback invocations in workflow agents (#831) * feat(adk): define GenModelInput config for summarization middleware (#833) * feat: optimize type name (#839) * test: add reduction mw ut (#841) * refactor(filesystem): remove hardcoded system prompts and add streaming shell tests (#842) Remove the default system prompt injection logic from NewMiddleware and New, keeping only custom prompt support. Delete unused ToolsSystemPrompt and ExecuteToolsSystemPrompt constants from prompt.go. Add comprehensive test coverage for streaming shell execution, validation, and edge cases. * feat(adk): remove sp of write_todos (#838) * refactor(skill): simplify AgentHub interface and improve test coverage (#849) * refactor(filesystem): optimize Read to return FileContent and avoid allocations (#850) - Change Backend.Read return type from string to FileContent struct for extensibility - Optimize InMemoryBackend.Read to use strings.IndexByte scanning instead of strings.Split/Join, eliminating unnecessary allocations for large files - Add fast path for the common case (no offset, content within limit) - Fix default limit from 200 to 2000 to match ReadRequest documentation - Fix offset to be strictly 1-based as documented in ReadRequest - Move line number formatting from backend to middleware layer (separation of concerns) - Add comprehensive Read edge case tests * chore: update gitignore Change-Id: Ia71dc2f76902414750772b8be0a413c7f7d1d2db --------- Co-authored-by: Zhj <zhuangjie.1125@bytedance.com> Co-authored-by: Megumin <wangdezheng@bytedance.com> Co-authored-by: mrh997 <maronghong@bytedance.com> Co-authored-by: Ryo <fanlvlgh@gmail.com> Co-authored-by: N3ko <xuzhaonan@bytedance.com> Co-authored-by: IPender <lipandeng@bytedance.com> | 6 months ago | |
feat(ci): enable golangci-lint (#602) | 8 months ago | |
feat: define AgenticModel component interface | 3 months ago | |
feat: define AgenticModel component interface | 3 months ago | |
feat: add dev and AI setup scripts (#856) Adds setup tooling to make cross-repo development and AI-assisted usage of Eino easier: scripts/dev_setup.sh: clones eino-ext and eino-examples under this repo and generates a gitignored go.work for full cross-module LSP (go-to-definition, type info, autocomplete). scripts/eino_setup.sh: for downstream projects, clones eino + eino-ext + eino-examples into a gitignored _eino/ reference directory so AI assistants can browse framework source and examples. Also: Adds llms.txt for AI tooling discoverability. Enriches GoDoc across components/, schema/, and callbacks/ to align with the official docs and improve in-editor guidance. Updates .gitignore to avoid accidentally committing local/AI setup artifacts. Motivation Working across eino / eino-ext / eino-examples currently requires manual cloning and editor setup. Editors and AI tools often lack cross-module navigation, which slows iteration and can lead to incorrect wiring. Design Notes dev_setup.sh uses .git/info/exclude so ext/ and examples/ stay local-only without changing the public repo’s tracked files. eino_setup.sh uses _eino/ (gitignored) so downstream repos keep normal go.mod dependencies while still giving assistants full source context. Package-level documentation is centralized in doc.go files to satisfy linting rules. | 5 months ago |
Eino
English | 中文
简介
Eino['aino] 是一个 Go 语言的 LLM 应用开发框架,借鉴了 LangChain、Google ADK 等开源项目,按照 Go 的惯例设计。
Eino 提供:
- 组件:
ChatModel、Tool、Retriever、ChatTemplate等可复用模块,官方实现覆盖 OpenAI、Ollama 等 - 智能体开发套件(ADK):支持工具调用、多智能体协同、上下文管理、中断/恢复等人机交互,以及开箱即用的智能体模式
- 编排:把组件组装成图或工作流,既能独立运行,也能作为工具给智能体调用
- 示例:常见模式和实际场景的可运行代码

快速上手
ChatModelAgent
配置好 ChatModel,加上工具(可选),就能跑起来:
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)
}
加工具让智能体有更多能力:
agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
Model: chatModel,
ToolsConfig: adk.ToolsConfig{
ToolsNodeConfig: compose.ToolsNodeConfig{
Tools: []tool.BaseTool{weatherTool, calculatorTool},
},
},
})
智能体内部自动处理 ReAct 循环,自己判断什么时候调工具、什么时候回复。
→ ChatModelAgent 示例 · 文档
DeepAgent
复杂任务用 DeepAgent,它会把问题拆成步骤,分派给子智能体,并追踪进度:
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 可以配置成:协调多个专业智能体、跑 shell 命令、执行 Python、搜索网络。
→ DeepAgent 示例 · 文档
编排
需要精确控制执行流程时,用 compose 搭图或工作流:
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)
编排出来的流程可以包装成工具给智能体用,把确定性流程和自主决策结合起来:
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},
},
},
})
这样你可以写出精确可控的业务流程,再让智能体决定什么时候调用。
→ GraphTool 示例 · 编排文档
主要特性
组件生态
Eino 定义了组件抽象(ChatModel、Tool、Retriever、Embedding 等),官方实现覆盖 OpenAI、Claude、Gemini、Ark、Ollama、Elasticsearch 等。
→ eino-ext
流式处理
Eino 在编排中自动处理流式:拼接、装箱、合并、复制。组件只需实现有业务意义的流式范式,框架处理剩下的。
→ 文档
回调切面
在固定切点(OnStart、OnEnd、OnError、OnStartWithStreamInput、OnEndWithStreamOutput)注入日志、追踪、指标,适用于组件、图、智能体。
→ 文档
中断/恢复
任何智能体或工具都能暂停等待人工输入,从检查点恢复。框架处理状态持久化和路由。
框架结构

Eino 框架包含:
-
Eino(本仓库):类型定义、流处理机制、组件抽象、编排、智能体实现、切面机制
-
EinoExt:组件实现、回调处理器、使用示例、评估器、提示优化器
-
Eino Devops:可视化开发和调试
-
EinoExamples:示例应用和最佳实践
文档
依赖
- Go 1.18 及以上
代码规范
本仓库使用 golangci-lint,本地检查:
golangci-lint run ./...
规则:
- 导出的函数、接口、package 等需要 GoDoc 注释
- 代码格式符合
gofmt -s - import 顺序符合
goimports(std -> third party -> local)
安全
如果你在该项目中发现潜在的安全问题,或你认为可能发现了安全问题,请通过我们的安全中心 或漏洞报告邮箱通知字节跳动安全团队。
请不要创建公开的 GitHub Issue。
联系我们
- 成为 member:COMMUNITY MEMBERSHIP
- Issues:Issues
- 飞书:扫码加入 CloudWeGo/eino 用户群

开源许可证
本项目基于 Apache-2.0 许可证 开源。
Introduction
The ultimate LLM/AI application development framework in Go.