Skip to main content

agent1

A simple LLM abstraction layer for Python applications.

Features

  • Unified API: Single interface for multiple LLM providers (OpenAI, Anthropic, etc.)
  • Flexible Content Types: Support for text, images, audio, and file inputs
  • Message Abstraction: Unified message handling across different API types

Installation

pip install agent1

Quick Start

from agent1 import Message, Agent

# 1. Create a Message
message = Message(
    content="What is the capital of France?",
    role="user"
)

# 2. Create an Agent
agent = Agent(
    instruction="You are a helpful assistant.",
    model="gpt-4"
)

# 3. Load an Agent from config file
# agent = Agent.load("config/agent.toml")

# 4. Do work (synchronous)
response = agent.work([message])
print(response.content)

# 5. Stream responses
for chunk in agent.stream([message]):
    if hasattr(chunk, 'content'):
        print(chunk.content, end='', flush=True)

Advanced

Loading Agent from Config File

Create a config file (supports .toml, .json, .yaml, .yml):

# agent.toml
instruction = "You are a helpful assistant that specializes in Python programming."
model = "gpt-4"
temperature = 0.7

Load and use the agent:

from agent1 import Agent, Message

# Load agent from config file
agent = Agent.load("agent.toml")

message = Message(
    content="How do I create a list comprehension in Python?",
    role="user"
)

response = agent.work([message])
print(response.content)

Async Methods

For non-blocking operations, use async methods:

import asyncio
from agent1 import Agent, Message

async def main():
    agent = Agent(
        instruction="You are a helpful assistant.",
        model="gpt-4"
    )
    
    message = Message(
        content="Explain quantum computing in simple terms.",
        role="user"
    )
    
    # Async work
    response = await agent.work_async([message])
    print(response.content)
    
    # Async streaming
    async for chunk in agent.stream_async([message]):
        if hasattr(chunk, 'content'):
            print(chunk.content, end='', flush=True)

# Run the async function
asyncio.run(main())

Metadata

Release files for agent1 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent1 0.1.18
File Size Uploaded Provenance Actions
agent1-0.1.18.tar.gz 2.0 MB Without provenance Details for agent1-0.1.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent1 0.1.18
File Interpreter ABI Platform Actions
agent1-0.1.18-py3-none-any.whl Python 3 none any Details for agent1-0.1.18-py3-none-any.whl

Total release size: 2.0 MB

Release files / agent1-0.1.18.tar.gz

Download URL agent1-0.1.18.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f74aa189f3b1957fee0c9ffb8708cac321256cf4d1332c0a905954903912ea45
BLAKE2b-256 checksum
How to use checksums
3e9806dd5c348d6c2c2448890d463ba07dbfaacc099c709507ec1c78b57c4875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / agent1-0.1.18-py3-none-any.whl

Download URL agent1-0.1.18-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2aa0251293df46aecb4ebd407b4bdd0de8506e7020554d57fdaa978b1974ba86
BLAKE2b-256 checksum
How to use checksums
d52ab9992f497da76a0b15eff311504f3fab74ad5c23dfd00be7f3954a98dbac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for agent1 0.1.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.18 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page