sagents  by sagents-ai

Elixir framework for interactive AI agents

Created 8 months ago
276 stars

Top 94.7% on SourcePulse

GitHubView on GitHub
Project Summary

Sagents provides a robust Elixir framework for building interactive AI agents, integrating LLM capabilities with Elixir's OTP for production-ready applications. It targets Elixir developers needing real-time user interaction, human oversight, and scalable agent orchestration, offering a powerful alternative to simpler LangChain integrations for complex, interactive systems.

How It Works

The system leverages Elixir's OTP GenServer and supervision trees for fault-tolerant agent processes. Agents are constructed as explicit, composable Elixir pipelines (execution modes) built from reusable steps, integrating LangChain for LLM calls. A sophisticated middleware system allows for modular extension of agent capabilities, while features like Human-In-The-Loop (HITL) and SubAgents enhance control and delegation. Phoenix integration provides real-time UI updates and smart resource management.

Quick Start & Requirements

  • Installation: Add {:sagents, "~> 0.9.0"} to mix.exs.
  • Prerequisites: Elixir/OTP, LLM API keys (Anthropic, OpenAI, Google) configured as environment variables, Phoenix.PubSub, Phoenix.Presence. Optional: Horde for distributed deployments.
  • Setup: Integrate Sagents.Supervisor into your application's supervision tree. Configure LLM providers and models.
  • Resources: See agents_demo for an interactive example and sagents_live_debugger for debugging tools. LangChain documentation provides detailed LLM configuration.

Highlighted Details

  • Human-In-The-Loop (HITL): Granular control over sensitive operations with customizable approval workflows for individual tool calls.
  • Composable Execution Modes: Define agent run loops as explicit Elixir pipelines, mixing built-in or custom steps.
  • SubAgents: Enable delegation of complex tasks to specialized child agents for efficient context management and parallel execution.
  • Extensible Middleware: A plugin architecture for adding features like task management (TodoList), virtual file systems (FileSystem), summarization, and observability.
  • Real-time Integration: Seamless integration with Phoenix LiveView via PubSub for streaming events and Presence for intelligent resource management.
  • Cluster-Aware Distribution: Optional Horde integration for distributed agent execution across a cluster with state migration.
  • Structured Completion: until_tool mode enforces structured output by looping until a specific tool is called.
  • Virtual Filesystem: Provides isolated, in-memory file operations with optional persistence.

Maintenance & Community

No specific details on maintainers, community channels (e.g., Discord, Slack), or roadmap were found in the provided README.

Licensing & Compatibility

  • License: Apache-2.0.
  • Compatibility: Permissive license suitable for commercial use and integration into closed-source applications.

Limitations & Caveats

Requires significant Elixir/OTP development expertise. Relies on external LLM providers, necessitating API key management and incurring usage costs. Distributed deployments require understanding and configuring Horde.

Health Check
Last Commit

13 hours ago

Responsiveness

Inactive

Pull Requests (30d)
28
Issues (30d)
2
Star History
0 stars in the last 30 days

Explore Similar Projects

Starred by Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), Elvis Saravia Elvis Saravia(Founder of DAIR.AI), and
8 more.

langgraph by langchain-ai

0.1%
43k
Agent orchestration framework for building controllable agents
Created 3 years ago
Updated 16 hours ago
Feedback? Help us improve.