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-cjsoncffi-lua- For better interaction experience, readline should be installed. This isn't a hard dependency though.
It executes $HOME/.config/a1ex/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 keyhideReasoning: boolean, whether to hide reasoning contentpretty: function, pretty printer to customize output style, its prototype should look likefunction pretty(what, content), and should return the stylized content (e.g., with terminal escaping sequence applied)whatrepresents type of the content, and currently the following values are defined,- "assistant": Assistant replies
- "reasoning": Assistant reasoning content
- "tool": Tool call invocation
- "info": System information (token usage, etc.)
- "warning": System warnings (network traffic issues, etc.)
arguments, table, should contain JSON-respresentable simple values (number, string, boolean, etc.) only. They would be copied to requests sent to servers as-is.
The description of command line arguments could be obtained by invoking a1ex
with --help.
MPL-2.0. This small program is written by hand.
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.