Catalog PyPI
PACKAGE EXPLORERView in registry

agent1

PyPI

A simple LLM abstraction layer

abstractionaianthropicllmopenai
Versions collected1
Direct dependencies3From release 0.1.18
Last observed20 Oct, 21:26 UTC

README

Version 0.1.18 documentation

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())

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.182 Mar 20263

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
vincentdeneuf/agent1

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fbe140d3be11911b96c43c5328c0dbe9829918d6313b184bfa02b99b217ad9dc