Ergonomic LLM Agent Augmented with Tools
Project description
Agentia: Ergonomic LLM Agent Augmented with Tools
Getting Started
from agentia import Agent
from typing import Annotated
# Define a tool as a python function
def get_weather(location: Annotated[str, "The city name"]):
"""Get the current weather in a given location"""
return { "temperature": 72 }
# Create an agent
agent = Agent(tools=[get_weather])
# Run the agent with the tool
response = await agent.run("What is the weather like in boston?")
print(response)
# Output: The current temperature in Boston is 72°F.
Agent Config File
Agentia supports creating agents from config files:
- Create a config file at
./alice.toml
[agent]
name = "Alice" # This is the only required field
icon = "👩"
instructions = "You are a helpful assistant"
model = "openai/o3-mini"
plugins = ["calc", "clock", "web"]
- In your python code:
agent = Agent.load_from_config("./alice.toml")
- Alternatively, start a REPL:
uvx agentia repl alice
Multi-Agent Orchestration
Multi-agent orchestration is achieved by making leader/parent agents dispatching sub-tasks to their sub-agents.
from agentia import Agent, CommunicationEvent, AssistantMessage
coder = Agent(
model="openai/gpt-4o-mini",
name="Coder",
description="programmar",
)
reviewer = Agent(
model="openai/gpt-4o-mini",
name="Code Reviewer",
description="code reviewer",
)
leader = Agent(
model="openai/gpt-4o-mini",
name="Leader",
description="Leader agent",
subagents=[
coder,
reviewer,
],
)
run = leader.run(
"Ask your subagents to write a quicksort algorithm in python, review and improve it until it is perfect."
events=True,
)
async for e in run:
if isinstance(e, CommunicationEvent):
subagent_name = coder.name if e.child == coder.id else reviewer.name
if e.response is None:
print(f"[DISPATCH -> {subagent_name}]")
print(e.message)
print("[DISPATCH END]")
print()
else:
print(f"[RESPONSE <- {subagent_name}]")
print(e.response)
print("[RESPONSE END]")
print()
if isinstance(e, AssistantMessage):
print(e.content)
print()
Multi-agent orchestration in agent config files:
[agent]
name = "Leader"
# ... other fields
# Create two subagent config files in the same directory: coder.toml and reviewer.toml
subagents = ["coder", "reviewer"]
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
agentia-0.0.9.tar.gz
(49.2 kB
view details)
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
agentia-0.0.9-py3-none-any.whl
(63.8 kB
view details)
File details
Details for the file agentia-0.0.9.tar.gz.
File metadata
- Download URL: agentia-0.0.9.tar.gz
- Upload date:
- Size: 49.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fa3f3d851d5f1be4b1f2e9232a9c72c40d3fdd4a8f54faf57967a11dd0540e
|
|
| MD5 |
935ceed021672ff65bd96e958b5510c1
|
|
| BLAKE2b-256 |
d21b51c1d29209c66c02566b1ad8c196972ccacd1e5c623ab4f000e922c14b4c
|
File details
Details for the file agentia-0.0.9-py3-none-any.whl.
File metadata
- Download URL: agentia-0.0.9-py3-none-any.whl
- Upload date:
- Size: 63.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
150c5187ef43ce87b1918e40cd37018f33f7f5c0e33fd2536bcbe3de58e9722b
|
|
| MD5 |
16f2940780b541c704a9263bb618cb8f
|
|
| BLAKE2b-256 |
74d609cf01d1a48c86f3630c8c57c02548a751d6fabf3b3b0c087552c3b3792f
|