Skip to main content

A lightweight, extensible framework for building AI agent.

Project description

LiteAgent

codecov

Introduction

LiteAgent is an easy-to-learn, lightweight, and extensible AI agent framework built on top of the official OpenAI Python SDK. It is designed as a minimal yet practical implementation for quickly building intelligent assistants and chatbots with robust tool-calling capabilities. The codebase is intentionally simple, making it ideal for learning, extension, and rapid prototyping.

Key Advantages:

  • Minimal and approachable: The simplest agent implementation for fast learning and hacking.
  • Accurate and complete type hints: All function signatures are fully type-hinted and never faked, ensuring reliable developer experience and static analysis.
  • Flexible parameter definition: Supports defining tool function parameters using basic types, Pydantic models, or Python dataclasses—even in combination.
  • Streaming responses: Seamless support for OpenAI streaming output.
  • Custom tool functions: Easily integrate your own Python functions (e.g., weather, temperature queries).
  • Rich type annotations, Pydantic-based.
  • Easy to extend and test.

Installation

You can install LiteAgent directly from PyPI:

pip install lite-agent

Or use uv:

uv pip install lite-agent

If you want to install from source for development:

uv pip install -e .
# or
pip install -e .

Quick Start

Code Example

See examples/basic.py:

import asyncio
from lite_agent.agent import Agent
from lite_agent.runner import Runner

async def get_whether(city: str) -> str:
    await asyncio.sleep(1)
    return f"The weather in {city} is sunny with a few clouds."

async def main():
    agent = Agent(
        model="gpt-4.1",
        name="Weather Assistant",
        instructions="You are a helpful weather assistant.",
        tools=[get_whether],
    )
    runner = Runner(agent)
    resp = await runner.run_until_complete("What's the weather in New York?")
    for chunk in resp:
        print(chunk)

if __name__ == "__main__":
    asyncio.run(main())

See pyproject.toml for details.

Testing

pytest

License

MIT License

Author

Jianqi Pan (jannchie@gmail.com)

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

lite_agent-0.16.4.tar.gz (307.2 kB view details)

Uploaded Source

Built Distribution

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

lite_agent-0.16.4-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file lite_agent-0.16.4.tar.gz.

File metadata

  • Download URL: lite_agent-0.16.4.tar.gz
  • Upload date:
  • Size: 307.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for lite_agent-0.16.4.tar.gz
Algorithm Hash digest
SHA256 8f74ee7cbb1e03d6228a1f0c8be491d9ebd8c85b2c3c03e835af4b7111687cf5
MD5 fe0fbd7e25aa5e47cda6bc34ddc6a000
BLAKE2b-256 27cd52dc0d0b6002f786706bd0d657f07df89ffe816c53450103ab328662dc20

See more details on using hashes here.

File details

Details for the file lite_agent-0.16.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lite_agent-0.16.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d9e97f12582816154614977e541e5596553d8675ce9a8e458174b32dc826d414
MD5 ed00d6cb044412dff579958e8f933bec
BLAKE2b-256 c641d9eb0e524568115786aa467ff31718f818bfff9c5e80bd76397237506e09

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