A library for creating agents
Project description
artificer-agents
A lightweight Python library for running deterministic agent loops with MCP tools.
Installation
pip install artificer-agents
# With OpenAI support
pip install artificer-agents[openai]
Requires Python 3.13+.
Usage
Define agents as classes:
import asyncio
from pydantic import BaseModel
from artificer.agents import Agent
from artificer.agents.mcp import MCPClient
from artificer.agents.models import OpenAIModel
class Input(BaseModel):
query: str
class Output(BaseModel):
result: str
class MyAgent(Agent):
system_prompt = "You are a helpful assistant."
model = OpenAIModel(model="gpt-4o-mini")
mcp_client = MCPClient(["path/to/mcp-server.py"]) # optional
_input_schema = Input
_output_schema = Output
async def main():
agent = MyAgent()
async with agent.mcp_client:
result = await agent.run(Input(query="Hello"), verbose=True)
print(result.result)
asyncio.run(main())
Simple String Agents
For simple str -> str agents, no schemas needed:
class SimpleAgent(Agent):
system_prompt = "Answer questions concisely."
model = OpenAIModel(model="gpt-4o-mini")
result = await SimpleAgent().run("What is Python?")
print(result.output) # StringOutput with .output field
Subagents
Agents can spawn other agents:
class ResearcherAgent(Agent):
system_prompt = "Research the topic and return findings."
model = model
mcp_client = mcp_client
_input_schema = ResearchInput
_output_schema = ResearchOutput
class OrchestratorAgent(Agent):
system_prompt = "Use the researcher subagent to gather info."
model = model
subagents = [ResearcherAgent()]
_input_schema = Input
_output_schema = Output
Development
uv sync # Install dependencies
./scripts/check.sh # Run all checks (lint, format, typecheck, tests)
./scripts/test.sh # Run tests only
./scripts/format.sh # Format code
License
MIT
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
artificer_agents-0.1.0a13.tar.gz
(96.9 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
File details
Details for the file artificer_agents-0.1.0a13.tar.gz.
File metadata
- Download URL: artificer_agents-0.1.0a13.tar.gz
- Upload date:
- Size: 96.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32a52b8f8d36cd65880f385b7eccb5602514f4127f080d9728d0de9a9d10b344
|
|
| MD5 |
4872a7352c90fb83d16ed24ff77b95e4
|
|
| BLAKE2b-256 |
3c05d404c9a8b26207f3edd483c43f6c3e4a3e8736ee183e67a47a47dcad28a0
|
File details
Details for the file artificer_agents-0.1.0a13-py3-none-any.whl.
File metadata
- Download URL: artificer_agents-0.1.0a13-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b76c2e9465b51a7325412ee2c8d332e7adca2db5dfe8f8fc7914b0f8aab28278
|
|
| MD5 |
0d0ef5134bf7bc9d04191d9476c49995
|
|
| BLAKE2b-256 |
d958847433429fed5c9942b8f25d5459d955aa5d3b878b3de885712fb7e71ded
|