gogentic

module
v0.8.43 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0

README

gogentic

LLM Agents in Go

Overview

gogentic is a modular, extensible framework for building agentic LLM (Large Language Model) applications in Go. It is inspired by and forked from langchaingo, with a focus on improved tool and assistant abstractions, schema generation, and MCP (Message Control Protocol) support.

Features

  • Agentic LLM Flows: Compose complex agent behaviors using assistants, tools, and callbacks.
  • Schema Generation: Automatic JSON schema generation for tool parameters and message formats.
  • MCP Support: Native integration with MCP for distributed, real-time, and local transport communication.
  • Pluggable Tools: Easily define, register, and use tools with LLM agents.
  • Multi-format Encoding: Support for JSON, YAML, TOML, and custom encodings.
  • Memory and Persistence: In-memory and Redis-backed chat/message stores.
  • Testable and Extensible: Mocking, test utilities, and clear interfaces for rapid development.

Architecture

  • assistants/: Core agent and assistant logic, tool orchestration, and callback handling.
  • tools/: Tool interface, registration, and MCP integration. Includes example tools (e.g., tavily).
  • llmfactory/: LLM model factory and configuration (OpenAI, Azure, etc.).
  • chatmodel/: Message and IO schema definitions for chat-based LLMs.
  • encoding/: Pluggable encoders/decoders (json, yaml, toml, dummy).
  • store/: Message and chat storage (memory, Redis).
  • mcp/: Model Context Protocol extensions to mcp-golang (local, SSE, internal transport).
  • schema/: JSON schema generation utilities.
  • llmutils/: Utility functions for LLM operations.
  • mocks/: Mock implementations for testing.

Quickstart

go get github.com/effective-security/gogentic

See assistants/assistants.go and tools/tools.go for core interfaces and extension points.

Usage Example

import (
    "github.com/effective-security/gogentic/assistants"
    "github.com/effective-security/gogentic/tools"
)

// Define and register tools, create an assistant, and run agentic flows...

Coding Guidelines

See AGENTS.md for detailed coding standards, error handling, and testing practices.

  • Use require and assert from testify for tests
  • Use cockroachdb/errors for error handling
  • Prefer table-driven and parallel tests
  • Document all exported types, functions, and interfaces

Contributing

  • Run make lint and make test before submitting PRs
  • Follow the guidelines in AGENTS.md

License

Apache 2.0

Directories

Path Synopsis
Package assistants provides core logic for LLM agents, including assistant orchestration, tool integration, and callback handling.
Package assistants provides core logic for LLM agents, including assistant orchestration, tool integration, and callback handling.
Package chatmodel includes base IO schema definitions and message types for chat-based LLMs.
Package chatmodel includes base IO schema definitions and message types for chat-based LLMs.
Package encoding provides a pluggable framework for encoding and decoding data in various formats (JSON, YAML, TOML, etc.) for agentic flows.
Package encoding provides a pluggable framework for encoding and decoding data in various formats (JSON, YAML, TOML, etc.) for agentic flows.
dummy
Package dummy encoder/decoder
Package dummy encoder/decoder
json
Package json json encoder/decoder
Package json json encoder/decoder
toml
Package toml encoder/decoder
Package toml encoder/decoder
yaml
Package yaml encoder/decoder
Package yaml encoder/decoder
mcp
Package mcp provides support for Message Control Protocol (MCP) transports, including local and SSE-based communication for distributed agentic flows.
Package mcp provides support for Message Control Protocol (MCP) transports, including local and SSE-based communication for distributed agentic flows.
localtransport
Package localtransport implements local transport mechanisms for MCP, enabling efficient in-process and local communication for agentic flows.
Package localtransport implements local transport mechanisms for MCP, enabling efficient in-process and local communication for agentic flows.
sse
Package sse implements Server-Sent Events (SSE) transport for MCP, enabling real-time, bidirectional communication for agentic flows over HTTP.
Package sse implements Server-Sent Events (SSE) transport for MCP, enabling real-time, bidirectional communication for agentic flows over HTTP.
sse/internal/sse
Package sse provides the low-level implementation of Server-Sent Events (SSE) transport for MCP, handling connection management, message streaming, and protocol details.
Package sse provides the low-level implementation of Server-Sent Events (SSE) transport for MCP, handling connection management, message streaming, and protocol details.
Package mocks provides mock implementations of assistants, tools, and LLMs for testing and development purposes.
Package mocks provides mock implementations of assistants, tools, and LLMs for testing and development purposes.
mockassitants
Package mockassitants is a generated GoMock package.
Package mockassitants is a generated GoMock package.
mockllms
Package mockllms is a generated GoMock package.
Package mockllms is a generated GoMock package.
mocktools
Package mocktools is a generated GoMock package.
Package mocktools is a generated GoMock package.
pkg
llmfactory
Package llmfactory provides factories and configuration for LLM model instantiation, supporting multiple providers (OpenAI, Azure, etc.) and model selection strategies.
Package llmfactory provides factories and configuration for LLM model instantiation, supporting multiple providers (OpenAI, Azure, etc.) and model selection strategies.
llmutils
Package llmutils provides utility functions and helpers for LLM operations, including prompt formatting, message handling, and other agentic utilities.
Package llmutils provides utility functions and helpers for LLM operations, including prompt formatting, message handling, and other agentic utilities.
schema
Package schema provides utilities for generating JSON schemas from Go types, enabling validation and documentation of tool and message parameters.
Package schema provides utilities for generating JSON schemas from Go types, enabling validation and documentation of tool and message parameters.
Package store provides interfaces and implementations for chat and message storage, supporting in-memory and Redis backends for agentic flows.
Package store provides interfaces and implementations for chat and message storage, supporting in-memory and Redis backends for agentic flows.
Package tools defines the Tool interface for LLM agents, including registration, parameter schema, and MCP integration.
Package tools defines the Tool interface for LLM agents, including registration, parameter schema, and MCP integration.

Jump to

Keyboard shortcuts

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