Create OpenAI API Compatible, Task driven agents.
Project description
amok
Currently WIP.
Python framework to create "Agents" of certain types.
The name is a play on the image of LLMs as little minions running amok.
Details.
There are currently the below types of agents:
- Action Agent - An agent that can perform actions based on given commands and input.
- Option Agent - An agent that can selects options based on given commands and input.
You can create your own agent type by sub-classing the BaseAgent.
API Modes
amok now supports both OpenAI-compatible request styles:
chat.completions(default)responses
Set api_mode in your settings/config:
api_mode = "responses"
Tool Calling
You can provide tool schemas and tool behavior controls in agent settings:
api_mode = "responses"
tool_choice = "auto"
parallel_tool_calls = true
[[tools]]
type = "function"
name = "lookup_weather"
description = "Get weather by city"
parameters = { type = "object", properties = { city = { type = "string" } }, required = ["city"] }
Tool Schema By api_mode
Function tools use different native wire formats per API mode:
chat.completionsexpects a nestedfunctionobject.responsesexpects top-levelname/description/parameters.
amok accepts either shape and normalizes to the correct wire format for the selected api_mode.
chat.completions native shape:
[[tools]]
type = "function"
function = { name = "lookup_weather", description = "Get weather by city", parameters = { type = "object", properties = { city = { type = "string" } }, required = ["city"] } }
responses native shape:
[[tools]]
type = "function"
name = "lookup_weather"
description = "Get weather by city"
parameters = { type = "object", properties = { city = { type = "string" } }, required = ["city"] }
Tool Control Fields
tool_choiceis forwarded as-is to the underlying API.parallel_tool_callsis forwarded as-is when notNone.- If
toolsis empty, tool calling is disabled.
Returned Tool Calls
Tool calls are returned in AgentResponse.tool_calls as normalized dictionaries.
Normalized keys you may receive:
idtypenameargumentscall_id(responses API)status(responses API)
Expected Flow
- Call
agent.run(body)with tools configured. - If
response.tool_callsis non-empty, execute those tools in your app. - Send tool outputs back to your model endpoint (for responses-style tool loop).
- Use the follow-up model output as the final user-visible answer.
Create Agent from a Config File.
You can easily spin up agents from a config file.
The currently supported config file formats are yaml, json, and toml.
The fields in the config file are based on the Agent Options class for your agent type.
Example
config.toml
base_url = "http://localhost:1234/v1"
model = "google/gemma-3-12b"
temperature = 0.1
max_tokens = 4000
description = "Parse messages to extract the username from them, if present."
commands = [
"You will parse the body of the message to extract the username.",
"ONLY reply with the username, nothing else.",
"No other information is needed. No formatting, no explanations, nothing else!",
"You need to be > 99% sure about your answer.",
"Reply with 'NO_RESULT' in case no username is given or you arent sure.",
]
Python Code
from amok import ActionAgent
uname_agent = ActionAgent.from_cfg("./config.toml")
Development
- Create a virtual environment (recommended):
python3.12 -m venv .venv source .venv/bin/activate
- Install dependencies:
pip install -e .
Requirements
- Python 3.12 or newer is required.
Running Tests
To Run tests, install pytest and pytest-cov first.
# With Pytest configured in the pyproject.toml, you can run:
pytest .
# Optional
pytest --cov=amok --cov-report=term-missing tests
Running Linters
black .
ruff check
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file amok-0.2.1.tar.gz.
File metadata
- Download URL: amok-0.2.1.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdcd6861fc74418f299044d4117347e44778d8fea5b842e4bfcd8df2c92f35e1
|
|
| MD5 |
9d7dd6b4228721cbf00325dff1b78be5
|
|
| BLAKE2b-256 |
480a686379abc8f19a1a68d5a23153827eb646178bfe7f556b9dc282c24d1976
|
Provenance
The following attestation bundles were made for amok-0.2.1.tar.gz:
Publisher:
publish.yml on rapidclock/amok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amok-0.2.1.tar.gz -
Subject digest:
cdcd6861fc74418f299044d4117347e44778d8fea5b842e4bfcd8df2c92f35e1 - Sigstore transparency entry: 935337310
- Sigstore integration time:
-
Permalink:
rapidclock/amok@f183c21b9384a949390e098e3edfb44e291c4efc -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rapidclock
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f183c21b9384a949390e098e3edfb44e291c4efc -
Trigger Event:
release
-
Statement type:
File details
Details for the file amok-0.2.1-py3-none-any.whl.
File metadata
- Download URL: amok-0.2.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64bfc307d0e12ca8a4496e2f41bfccefeafeb26c4d102e06fb73a70ae32e62ab
|
|
| MD5 |
ecad5082c4c9241410ecdd7304f0ec62
|
|
| BLAKE2b-256 |
750e1ce590061a3b5f814d804b0342615cf843f39915124b1d056d99ce40ec70
|
Provenance
The following attestation bundles were made for amok-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on rapidclock/amok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amok-0.2.1-py3-none-any.whl -
Subject digest:
64bfc307d0e12ca8a4496e2f41bfccefeafeb26c4d102e06fb73a70ae32e62ab - Sigstore transparency entry: 935337324
- Sigstore integration time:
-
Permalink:
rapidclock/amok@f183c21b9384a949390e098e3edfb44e291c4efc -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rapidclock
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f183c21b9384a949390e098e3edfb44e291c4efc -
Trigger Event:
release
-
Statement type: