Documentation
¶
Overview ¶
Package einoacp provides an ACP-backed chat model implementation for Eino.
Index ¶
- func ClaudeCommand() []string
- func CodexCommand() []string
- func GeminiCommand() []stringdeprecated
- func UserMessages(content string) []*schema.Message
- type ChatModel
- func (cm *ChatModel) BindTools(_ []*schema.ToolInfo) error
- func (cm *ChatModel) Generate(_ context.Context, _ []*schema.Message, _ ...model.Option) (*schema.Message, error)
- func (cm *ChatModel) GetType() string
- func (cm *ChatModel) IsCallbacksEnabled() bool
- func (cm *ChatModel) Stream(ctx context.Context, input []*schema.Message, _ ...model.Option) (outStream *schema.StreamReader[*schema.Message], err error)
- func (cm *ChatModel) WithTools(_ []*schema.ToolInfo) (model.ToolCallingChatModel, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeCommand ¶
func ClaudeCommand() []string
ClaudeCommand returns the command to launch Claude Code via ACP.
func CodexCommand ¶
func CodexCommand() []string
CodexCommand returns the command to launch OpenAI Codex CLI via ACP. Uses the dedicated ACP adapter package from the ACP registry.
func GeminiCommand
deprecated
func GeminiCommand() []string
GeminiCommand returns the command to launch Google Gemini CLI via ACP.
NOTE: Gemini CLI in ACP mode currently does not work with OAuth authentication when launched as a subprocess. See upstream issue: https://github.com/google-gemini/gemini-cli/issues/12042
Deprecated: Use ClaudeCommand or CodexCommand instead until this is resolved.
func UserMessages ¶
UserMessages is a convenience function to create a single user message slice.
Types ¶
type ChatModel ¶
type ChatModel struct {
// contains filtered or unexported fields
}
ChatModel implements eino's model.ChatModel by communicating with any ACP-compatible coding agent (Claude Code, Codex CLI, etc.) over the Agent Client Protocol.
func NewChatModel ¶
NewChatModel creates a new ACP chat model.
func (*ChatModel) Generate ¶
func (cm *ChatModel) Generate(_ context.Context, _ []*schema.Message, _ ...model.Option) (*schema.Message, error)
Generate is not supported for ACP-based chat models.
ACP is a streaming-only protocol: the agent emits ordered session updates (tool_call → tool_call_update → agent_message_chunk) that must be consumed in real time. Collapsing them into a single *schema.Message via Generate destroys event ordering and streaming granularity.
Use Stream instead.
func (*ChatModel) IsCallbacksEnabled ¶
IsCallbacksEnabled reports whether callback hooks are enabled for this model.
type Config ¶
type Config struct {
// Command is the full command to launch the ACP agent.
// The first element is the binary, the rest are arguments.
// Use the provided helpers: ClaudeCommand(), CodexCommand().
// Required, must have at least one element.
Command []string
// Cwd is the working directory for the agent session.
// Defaults to the current working directory.
Cwd string
// Env sets additional environment variables for the agent subprocess.
// These are merged with the current process environment.
Env []string
// AutoApprove automatically approves all permission requests from the agent.
// When false, permission requests are denied.
AutoApprove bool
// OnSessionUpdate is called for every ACP SessionUpdate received during
// execution. This fires in real-time regardless of whether Generate() or
// Stream() is used, giving consumers access to tool calls, text chunks,
// and other ACP events as they happen.
OnSessionUpdate func(acp.SessionUpdate)
// McpServers is the list of MCP servers to attach to each ACP session.
// Claude Code will discover and use tools from these servers.
McpServers []acp.McpServer
}
Config for the ACP-based chat model.