Skip to main content

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


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.0a15.tar.gz (98.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artificer_agents-0.1.0a15-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file artificer_agents-0.1.0a15.tar.gz.

File metadata

  • Download URL: artificer_agents-0.1.0a15.tar.gz
  • Upload date:
  • Size: 98.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for artificer_agents-0.1.0a15.tar.gz
Algorithm Hash digest
SHA256 5fba40e4693151cef8cf114a8a915f0fc8ebf0c5d9cbc35d550ddc4c8b7e6693
MD5 d8c2d67d750d3a96578487cf2d326a44
BLAKE2b-256 cee1736e9cee1a7a3e3803d270c02a5e812a2a64da5957285cbcd215b6885c9f

See more details on using hashes here.

File details

Details for the file artificer_agents-0.1.0a15-py3-none-any.whl.

File metadata

File hashes

Hashes for artificer_agents-0.1.0a15-py3-none-any.whl
Algorithm Hash digest
SHA256 9a60c999b9e98d02c39d6ff237823635e14dc7c7cf24eaa4ab01d2937cc45e42
MD5 de0dc9267ac1df9450cc513638816c4e
BLAKE2b-256 facba3f4a94612efd51e3c4ca561c323c18fb64908a3c96c304641076cc08a31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page