An agent that uses XAI to achieve goals by executing tools
Project description
agentxai
A lightweight, but effective autonomous agent framework powered by X.AI's Grok model.
Features
- AgentX: An autonomous agent that can execute complex missions using provided tools
tools: List of callable functions the agent can use to complete its mission- can be another agent, assuming the agent lives in a function
mission: String describing the goal or task to accomplishexit_function: Optional callback function executed upon mission completion- default is a success bool
system_prompt: Customizable prompt to guide agent behavior (default: autonomous goal-focused agent)model: AI model selection (default: "grok-beta")enable_logging: Toggle detailed logging (default: False)max_steps: Maximum execution steps before termination (default: 10)
- XAI: A robust client for interacting with X.AI's Grok model and other supported AI models
- Model Selection: Choose from three AI models to power your agents
grok-beta: X.AI's Grok modelgpt-4o: OpenAI's GPT-4 optimized for performancegpt-4o-mini: A lightweight version of GPT-4 optimized for minimal resource usage
- Cost tracking and token usage monitoring
- Automatic retries and error handling
- JSON response validation
- Configurable logging
Model Selection
AgentXAI supports three AI models, each with different capabilities and cost structures. You can select the desired model when initializing AgentX or XAI.
Available Models
-
grok-beta
- Provider: X.AI
- Cost:
- Input Tokens: $5.00 per 1M tokens
- Output Tokens: $15.00 per 1M tokens
-
gpt-4o
- Provider: OpenAI
- Cost:
- Input Tokens: $2.50 per 1M tokens
- Output Tokens: $10.00 per 1M tokens
-
gpt-4o-mini
- Provider: OpenAI
- Cost:
- Input Tokens: $0.150 per 1M tokens
- Output Tokens: $0.600 per 1M tokens
Selecting a Model
When initializing AgentX or XAI, specify the model parameter to select the desired AI model.
Example: Initializing AgentX with gpt-4o-mini
example agent:
from agentX.agent_x import AgentX
def my_function(input: str) -> str:
"""
A simple example function that can be passed to AgentX as a tool.
Args:
input (str): The input string to process
Returns:
str: The unmodified input string
"""
# do something with input
return input
def exit_function(message: str) -> int:
"""
A simple example exit function that can be passed to AgentX.
Args:
message (str): A string containing a number to convert
Returns:
int: The string converted to an integer
"""
try:
return int(message)
except ValueError:
return -1
agent = AgentX(
model="grok-beta",
tools=[my_function],
mission="""
Do something with
#1 setup
- some useful details
#2 do something
- some details
#3 last thing to do
- some details
success criteria:
- that something is done
- it is done well
""",
exit_function=exit_function,
)
Installation
pip install agentxai
ENV Variables
XAI_API_KEY=
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 agentxai-0.1.3.tar.gz.
File metadata
- Download URL: agentxai-0.1.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94b4a11bcbc9e96794b24b17b4605d150f17ff2e29fb82c7f6a1e14a3051f7c3
|
|
| MD5 |
2b94872b9a08db2b06ac338a0b87de8b
|
|
| BLAKE2b-256 |
e7c247c91706360d353ea67d2ca11a54ab47afbd864707d9fd0a0ae5d43fde58
|
Provenance
The following attestation bundles were made for agentxai-0.1.3.tar.gz:
Publisher:
publish.yml on wickthumb/agentxai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentxai-0.1.3.tar.gz -
Subject digest:
94b4a11bcbc9e96794b24b17b4605d150f17ff2e29fb82c7f6a1e14a3051f7c3 - Sigstore transparency entry: 151056079
- Sigstore integration time:
-
Permalink:
wickthumb/agentxai@82edc981da783013369c7e440e4702f037007caa -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/wickthumb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82edc981da783013369c7e440e4702f037007caa -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentxai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: agentxai-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5473c829e7d96ccb9c388ba3749e8e17a66d9fd83e8b053ef72cb3dbebd020b
|
|
| MD5 |
5f68e355deeab300bbf442bd5901f682
|
|
| BLAKE2b-256 |
32cbc7af6ee5c40264c3f8edb56e4ea0e774123f09fa71a9ae576e27df25d9e5
|
Provenance
The following attestation bundles were made for agentxai-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on wickthumb/agentxai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentxai-0.1.3-py3-none-any.whl -
Subject digest:
d5473c829e7d96ccb9c388ba3749e8e17a66d9fd83e8b053ef72cb3dbebd020b - Sigstore transparency entry: 151056082
- Sigstore integration time:
-
Permalink:
wickthumb/agentxai@82edc981da783013369c7e440e4702f037007caa -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/wickthumb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82edc981da783013369c7e440e4702f037007caa -
Trigger Event:
release
-
Statement type: