🔶 A1ex:一个用 Lua 编写的简单 LLM 编程 Agent
英文标题:🔶 A1ex: A simple LLM coding agent in Lua
A1ex 是一个使用 Lua 实现的轻量级 LLM 编程 Agent,可通过 LuaRocks 安装或直接运行 `a1ex.lua`。项目不提供工具调用沙箱或人工审批机制,作者强调 LLM Agent 本质上可能形成远程代码执行(RCE)风险,应放在独立容器或虚拟机中隔离运行。A1ex 通过 `$HOME/.config/a1ex.lua` 读取 OpenAI Completion 风格 API 端点、API Key 及请求参数配置,依赖 Lua 5.4、luaposix、lua-CURLv3 和 lua-cjson。该项目采用 MPL-2.0 许可证,但作者表示暂不接受公开代码贡献,仅欢迎通过 Issue 提交想法。
98.2 KB
中文
一个简单(而且很可能很差)的 Lua LLM 编程 Agent。
本项目未针对工具调用实现任何沙箱或审批机制。由于 LLM Agent 实际上相当于 RCE,请将它们隔离在独立的容器或虚拟机中运行。
从技术上说,任何被来自不可信来源的提示词攻破的 Agent,都可能窃取你的 API Key 并消耗其他宝贵资源。最佳解决方案是通过本地 API 网关转发请求,首先防止不受欢迎的人使用你的 LLM API Key 访问服务;同时,不要向 Agent 提供有价值的密钥或 Token:)
你应当能够通过 LuaRocks 安装它,或直接通过 a1ex.lua 调用。它依赖于:
lua5.4或更高版本;luaposixlua-CURLv3lua-cjson
它会在启动时执行 $HOME/.config/a1ex.lua,并从其返回值中读取配置。a1ex 需要一个表,并识别以下字段:
endpoint:字符串,OpenAI Completion 风格的 API 端点apiKey:字符串,即认证密钥arguments:表,仅应包含可表示为 JSON 的简单值(数字、字符串、布尔值等)。这些值将被原样复制到发送给服务器的请求中。
MPL-2.0。本小程序完全由手工编写。
关于公开贡献
这是一个由个人兴趣驱动的业余项目,因此不会接受公开贡献。仍然欢迎大家通过 Issue 发布有趣的想法。
English / 原文
A simple (and likely poor) LLM coding agent in Lua.
This project implements no sandboxing or approval mechanisms for tool calls. Since LLM agents are effectively RCEs, please isolate them in separate containers or VMs.
Technically, any agents, hacked by prompts from untrusted sources, could steal your API keys and consume your other valuable resources. The best solution is forwarding your requests through a local API gateway to prevent unwelcomed guys from accessing with your LLM API key at first, and do not provide valuable keys or tokens to your agent :)
You should be able to install it with luarocks, or invoke it directly through a1ex.lua. It depends on,
lua5.4or later,luaposixlua-CURLv3lua-cjson
It executes $HOME/.config/a1ex.lua on start, and retrieves configuration from its return value. a1ex expects a table, and recognizes following fields,
endpoint: string, OpenAI-completion-style API endpointapiKey: string, literally authentication keyarguments, table, should contain JSON-respresentable simple values (number, string, boolean, etc.) only. They would be copied to requests sent to servers as-is.
MPL-2.0. This small program is written by hand.
About public contribution
This is a side-project guided by interests, thus no public contribution will be accepted. Humans are still welcomed to post interesting ideas as issues.