{"id":30018144,"url":"https://github.com/doomspork/luagents","last_synced_at":"2026-01-20T16:51:02.306Z","repository":{"id":308085872,"uuid":"1030879800","full_name":"doomspork/luagents","owner":"doomspork","description":"Agents that think in Lua code. Inspired by smolagents.","archived":false,"fork":false,"pushed_at":"2025-08-04T02:39:29.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-04T04:52:35.936Z","etag":null,"topics":["agent","code-agent","llm","lua"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doomspork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-02T14:24:44.000Z","updated_at":"2025-08-04T02:42:04.000Z","dependencies_parsed_at":"2025-08-04T04:52:39.307Z","dependency_job_id":"755f2240-b80c-4368-97d1-b7f46ad66bb3","html_url":"https://github.com/doomspork/luagents","commit_stats":null,"previous_names":["doomspork/luagent"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/doomspork/luagents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomspork%2Fluagents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomspork%2Fluagents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomspork%2Fluagents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomspork%2Fluagents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doomspork","download_url":"https://codeload.github.com/doomspork/luagents/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomspork%2Fluagents/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268654943,"owners_count":24285126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","code-agent","llm","lua"],"created_at":"2025-08-05T23:47:46.591Z","updated_at":"2026-01-20T16:51:02.294Z","avatar_url":"https://github.com/doomspork.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Luagents\n\n[![Continuous Integration](https://github.com/doomspork/luagents/actions/workflows/ci.yml/badge.svg)](https://github.com/doomspork/luagents/actions/workflows/ci.yaml)\n[![Module Version](https://img.shields.io/hexpm/v/luagents.svg)](https://hex.pm/packages/luagents)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/luagents/)\n[![Total Download](https://img.shields.io/hexpm/dt/luagents.svg)](https://hex.pm/packages/luagents)\n[![License](https://img.shields.io/hexpm/l/luagents.svg)](https://github.com/doomspork/luagents/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/doomspork/luagents.svg)](https://github.com/doomspork/luagents/commits/main)\n\nA ReAct (Reasoning and Acting) agent implementation in Elixir that thinks using Lua code. Inspired by [smolagents](https://github.com/huggingface/smolagents).\n\n## Overview\n\nLuagents implements a ReAct loop where:\n1. The agent receives a task from the user\n2. It uses an LLM (Large Language Model) to generate Lua code to think through the problem step-by-step\n3. The Lua code can call tools and reason about results\n4. The agent continues until it finds a final answer\n\n## Supported LLM Providers\n\nLuagents supports multiple LLM providers through a pluggable architecture:\n\n- **Anthropic Claude** (via Anthropix) - Cloud-based, high-quality responses\n- **Ollama** - Local models, privacy-focused, customizable\n\n**Important Note**: This agent's performance is directly tied to the quality of the underlying language model. Using a model with strong reasoning and coding capabilities is essential for reliable results.\n\n## Installation\n\nAdd `luagents` to your dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:luagents, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Configuration\n\n### Anthropic Claude\n\nSet your Anthropic API key using one of these methods:\n\n1. Environment variable (recommended):\n```bash\nexport ANTHROPIC_API_KEY=your-api-key\n```\n\n2. Pass directly when creating an agent:\n```elixir\nagent = Luagents.Agent.new(\n  llm: Luagents.LLM.new(provider: :anthropic, api_key: \"your-api-key\")\n)\n```\n\n### Ollama\n\n1. Install and run [Ollama](https://ollama.com/)\n2. Pull a model (e.g., `ollama pull mistral`)\n3. Create an agent with Ollama provider:\n\n```elixir\nagent = Luagents.Agent.new(\n  llm: Luagents.LLM.new(provider: :ollama, model: \"mistral\")\n)\n```\n\n## Usage\n\n### Basic Usage\n\n```elixir\n# Create an agent (uses Anthropic Claude by default)\nagent = Luagents.create_agent(name: \"MyBot\")\n\n# Run a task\n{:ok, result} = Luagents.run_with_agent(agent, \"What is 2 + 2?\")\n```\n\n### Using Different LLM Providers\n\n```elixir\n# Use Ollama with a specific model\nagent = Luagents.create_agent(\n  name: \"OllamaBot\",\n  llm: Luagents.create_llm(:ollama, model: \"mistral\")\n)\n\n# Use Anthropic Claude with a specific model\nagent = Luagents.create_agent(\n  name: \"ClaudeBot\",\n  llm: Luagents.create_llm(:anthropic, model: \"claude-3-opus-20240229\")\n)\n```\n\n### Adding Custom Tools\n\n```elixir\n# Define custom tools using deflua or anonymous functions\ntools = %{\n  power: Luagents.Tool.new(\n    \"power\",\n    \"Calculate power (base^exponent)\",\n    [\n      %{name: \"base\", type: :number, description: \"Base number\", required: true},\n      %{name: \"exp\", type: :number, description: \"Exponent\", required: true}\n    ],\n    fn [base, exp] -\u003e :math.pow(base, exp) end\n  )\n}\n\n# Create agent with custom tools and configuration\nagent = Luagents.create_agent(\n  name: \"MathBot\",\n  llm: Luagents.create_llm(:ollama, model: \"mistral\"),\n  max_iterations: 15,\n  tools: tools\n)\n\n{:ok, result} = Luagents.Agent.run(agent, \"What is 10 to the power of 2?\")\n```\n\n### Built-in Tools\n\nLuagents provides several ready-to-use tools that can be easily added to your agents:\n\n#### JSON Tools (`Luagents.Tools.Json`)\nParse, encode, and format JSON data within your Lua agent code. Enables seamless conversion between JSON strings and Lua tables for working with APIs and structured data.\n\n- `parse(json_string)` - Parse JSON strings into Lua tables\n- `encode(data)` - Encode Lua tables/values into JSON strings\n- `pretty(data)` - Pretty-print JSON with formatting\n\n#### HTTP Client (`Luagents.Tools.Http`)\nMake HTTP requests to external APIs and services directly from your agent's Lua code. Supports all common HTTP methods with customizable headers and request bodies.\n\n- `get(url, headers?)` - Make HTTP GET requests\n- `post(url, body, headers?)` - Make HTTP POST requests\n- `put(url, body, headers?)` - Make HTTP PUT requests\n- `delete(url, headers?)` - Make HTTP DELETE requests\n\n#### Logger (`Luagents.Tools.Logger`)\nLog messages from your agent's reasoning process to Elixir's Logger at various levels. Useful for debugging, monitoring agent behavior, and capturing important events during task execution.\n\n- `debug(message, metadata?)` - Log debug-level messages\n- `info(message, metadata?)` - Log informational messages\n- `warning(message, metadata?)` - Log warnings\n- `error(message, metadata?)` - Log errors\n- `log(level, message, metadata?)` - Log at a specific level with optional metadata\n\n## Example Lua Thinking\n\nThe agent thinks in Lua code like this:\n\n```lua\nthought(\"I need to perform a calculation\")\n\nlocal a = 10\nlocal b = 20\nlocal sum = add(a, b)\n\nobservation(\"The sum is \" .. sum)\n\nlocal result = multiply(sum, 2)\nthought(\"Multiplying by 2 gives \" .. result)\n\nfinal_answer(\"The result is \" .. result)\n```\n\n## Contributing\n\nBefore opening a pull request, please open an issue first.\n\n    git clone https://github.com/doomspork/luagents.git\n    cd luagents \n    mix deps.get\n    mix test\n\nOnce you've made your additions and `mix test` passes, go ahead and open a PR!\n\n## License\n\nLuagents is Copyright © 2025 doomspork. It is free software, and may be\nredistributed under the terms specified in the [LICENSE](/LICENSE.md) file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomspork%2Fluagents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoomspork%2Fluagents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomspork%2Fluagents/lists"}