Skip to main content

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)

Metadata

Release files for lite-agent 0.16.5

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

Source distribution (sdist)

Source distribution for lite-agent 0.16.5
File Size Uploaded
lite_agent-0.16.5.tar.gz 448.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lite-agent 0.16.5
File Interpreter ABI Platform
lite_agent-0.16.5-py3-none-any.whl Python 3 none any Details

Total release size: 507.1 kB

Release files / lite_agent-0.16.5.tar.gz

Download URL lite_agent-0.16.5.tar.gz
Size 448.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d758be462c253097558f3040879f265b3f53c740107406cf498e4d2162871475
BLAKE2b-256 checksum
How to use checksums
d48858bb1e34ee92b87c7cc97148a98ce2d8de32fcef29fb46a5bdf079fb12f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / lite_agent-0.16.5-py3-none-any.whl

Download URL lite_agent-0.16.5-py3-none-any.whl
Size 58.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fe179c88e6da54c20608ae5521a342f329e982d50a9b59a788b87e909b7db74
BLAKE2b-256 checksum
How to use checksums
77734e66c8cbb38a381ff16036daf1cf4b72fe77a70bef84e720eec1138fbd3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.16.5 This release

2 release files

0.16.3

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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