agentia


Nameagentia JSON
Version 0.1.10 PyPI version JSON
download
home_pageNone
SummaryErgonomic LLM Agents
upload_time2025-10-26 07:07:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords agent ai-sdk chatgpt gpt llm openai openrouter tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Agentia: Ergonomic LLM Agents

Ergonomic LLM Agents, with chat messages fully compatible with [Vercel AI SDK](https://ai-sdk.dev/).

# Getting Started

Run agents with tools and MCP.

```python
from agentia import Agent, MCPServer, MCPContext
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 }

# Declare a MCP server:
calc = MCPServer(name="calculator", command="uvx", args=["mcp-server-calculator"])

# Create an agent
agent = Agent(model="openai/gpt-5-mini", tools=[get_weather, calc])

# Run the agent with the tool
async with MCPContext(): # This line can be omitted if not using MCP
    response = await agent.run("What is the weather like in boston?")

print(response.text)

# Output: The current temperature in Boston is 72°F.
```

# The Magic Decorator

Create agent-powered magic functions.

Support both plain types and pydantic models as input and output.

```python
from agentia import magic
from pydantic import BaseModel

class Forcast(BaseModel):
    location: str
    temperature_celsius: int

@magic
async def get_weather(weather_forcast: str) -> Forcast:
    """Create weather forcase object based on the input string"""
    ...

forcast = await get_weather("The current temperature in Boston is 72°F")

print(forcast.location) # Output: Boston
print(forcast.temperature_celsius) # Output: 22
```

# Supported Parameter and Result Types

* Any types that can be passed to `pydantic.TypeAdaptor`:
    * Builtin types: `int`, `float`, `str`, `bool`, `tuple[_]`, `list[_]`, `dict[_, _]`
    * Enums: `Literal['A', 'B', ...]`, `StrEnum`, `IntEnum`, and `Enum`
    * dataclasses
* `pydantic.BaseModel` subclasses

# Run agent as a REPL app

1. Create a config file at `./robo.toml`

```toml
[agent]
name = "Robo" # This is the only required field
icon = "🤖"
instructions = "You are a helpful assistant"
model = "openai/o3-mini"
plugins = ["clock"]

[mcp]
calc={ command = "uvx", args = ["mcp-server-calculator"] }
```

2. Load the agent

```python
agent = Agent.from_config("./robo.toml")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "agentia",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "agent, ai-sdk, chatgpt, gpt, llm, openai, openrouter, tools",
    "author": null,
    "author_email": "Wenyu Zhao <wenyuzhaox@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/df/5b/0be573dffb94585c1359b413791ff21f911af102a5326d16fef753ef857d/agentia-0.1.10.tar.gz",
    "platform": null,
    "description": "# Agentia: Ergonomic LLM Agents\n\nErgonomic LLM Agents, with chat messages fully compatible with [Vercel AI SDK](https://ai-sdk.dev/).\n\n# Getting Started\n\nRun agents with tools and MCP.\n\n```python\nfrom agentia import Agent, MCPServer, MCPContext\nfrom typing import Annotated\n\n# Define a tool as a python function\ndef get_weather(location: Annotated[str, \"The city name\"]):\n    \"\"\"Get the current weather in a given location\"\"\"\n    return { \"temperature\": 72 }\n\n# Declare a MCP server:\ncalc = MCPServer(name=\"calculator\", command=\"uvx\", args=[\"mcp-server-calculator\"])\n\n# Create an agent\nagent = Agent(model=\"openai/gpt-5-mini\", tools=[get_weather, calc])\n\n# Run the agent with the tool\nasync with MCPContext(): # This line can be omitted if not using MCP\n    response = await agent.run(\"What is the weather like in boston?\")\n\nprint(response.text)\n\n# Output: The current temperature in Boston is 72\u00b0F.\n```\n\n# The Magic Decorator\n\nCreate agent-powered magic functions.\n\nSupport both plain types and pydantic models as input and output.\n\n```python\nfrom agentia import magic\nfrom pydantic import BaseModel\n\nclass Forcast(BaseModel):\n    location: str\n    temperature_celsius: int\n\n@magic\nasync def get_weather(weather_forcast: str) -> Forcast:\n    \"\"\"Create weather forcase object based on the input string\"\"\"\n    ...\n\nforcast = await get_weather(\"The current temperature in Boston is 72\u00b0F\")\n\nprint(forcast.location) # Output: Boston\nprint(forcast.temperature_celsius) # Output: 22\n```\n\n# Supported Parameter and Result Types\n\n* Any types that can be passed to `pydantic.TypeAdaptor`:\n    * Builtin types: `int`, `float`, `str`, `bool`, `tuple[_]`, `list[_]`, `dict[_, _]`\n    * Enums: `Literal['A', 'B', ...]`, `StrEnum`, `IntEnum`, and `Enum`\n    * dataclasses\n* `pydantic.BaseModel` subclasses\n\n# Run agent as a REPL app\n\n1. Create a config file at `./robo.toml`\n\n```toml\n[agent]\nname = \"Robo\" # This is the only required field\nicon = \"\ud83e\udd16\"\ninstructions = \"You are a helpful assistant\"\nmodel = \"openai/o3-mini\"\nplugins = [\"clock\"]\n\n[mcp]\ncalc={ command = \"uvx\", args = [\"mcp-server-calculator\"] }\n```\n\n2. Load the agent\n\n```python\nagent = Agent.from_config(\"./robo.toml\")\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Ergonomic LLM Agents",
    "version": "0.1.10",
    "project_urls": {
        "Repository": "https://github.com/wenyuzhao/agentia"
    },
    "split_keywords": [
        "agent",
        " ai-sdk",
        " chatgpt",
        " gpt",
        " llm",
        " openai",
        " openrouter",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3186259cbee1fc60a99756dffe4e638e508c4de2a9f3a7ecb8def6efc53b2e75",
                "md5": "d8a97b7eab5d90603e4dbb6004ba8a79",
                "sha256": "a806ea35f48dc3bd6e305f3b1ccc0c8ecfab4668c5d25f190213a8f6f98aa8b9"
            },
            "downloads": -1,
            "filename": "agentia-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8a97b7eab5d90603e4dbb6004ba8a79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 41661,
            "upload_time": "2025-10-26T07:07:49",
            "upload_time_iso_8601": "2025-10-26T07:07:49.266338Z",
            "url": "https://files.pythonhosted.org/packages/31/86/259cbee1fc60a99756dffe4e638e508c4de2a9f3a7ecb8def6efc53b2e75/agentia-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "df5b0be573dffb94585c1359b413791ff21f911af102a5326d16fef753ef857d",
                "md5": "f8b81b15de140cc75bab515b1d8efb13",
                "sha256": "892c49687507260ec71669128e4f0c6f6d0ca9c36af36147477c4d4e4db41dfa"
            },
            "downloads": -1,
            "filename": "agentia-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f8b81b15de140cc75bab515b1d8efb13",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 31843,
            "upload_time": "2025-10-26T07:07:50",
            "upload_time_iso_8601": "2025-10-26T07:07:50.896540Z",
            "url": "https://files.pythonhosted.org/packages/df/5b/0be573dffb94585c1359b413791ff21f911af102a5326d16fef753ef857d/agentia-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-26 07:07:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wenyuzhao",
    "github_project": "agentia",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "agentia"
}
        
Elapsed time: 3.11353s