AGI Agents
A streamlined interface for LangChain AI agent creation with multi-modal support (text and images).
Features
- Simple API: Easy-to-use interface for creating AI agents
- Multi-modal Support: Handle both text and image inputs seamlessly
- LangChain Integration: Built on top of the powerful LangChain framework
- Flexible Models: Support for OpenAI, Anthropic, and other LLM providers
- Document Processing: PDF and image processing capabilities
- Context Management: Advanced context engineering utilities
- Async Support: Both synchronous and asynchronous execution
Installation
pip install agi-agents
Quick Start
from agi_agents import Agents
from langchain_openai import ChatOpenAI
# Initialize your model
llm = ChatOpenAI(model_name='gpt-4o-mini')
# Create a simple text processing chain
chain = Agents.chain_create(
model=llm,
text_prompt_template="Answer this question: {question}",
)
# Use the chain
response = Agents.chain_batch_generator(
chain,
{"question": "What is artificial intelligence?"}
)
print(response)
Multi-modal Example
# Create a chain that processes both text and images
chain = Agents.chain_create(
model=llm,
text_prompt_template="Describe this image: {description}",
image_prompt_template=True
)
# Process an image
base64_image = Agents.normalize_image_to_base64("path/to/image.jpg")
response = Agents.chain_batch_generator(
chain,
{
"description": "What do you see?",
"base64_image": base64_image,
"detail_parameter": "high"
}
)
Main Classes
Agents
The core class for creating and managing AI agents:
chain_create(): Create LangChain processing chainschain_batch_generator(): Execute chains synchronouslychain_stream_generator(): Stream responses in real-timecontinue_chain_batch_generator(): Handle long conversations with continuation
Contexts
Utility class for context engineering:
create_context_layer(): Create context templatescompress_context(): Compress contexts to fit token limits
Document
Document processing utilities:
extract_text_from_pdf(): Extract text from PDFsconvert_pdf_to_images(): Convert PDFs to imagespdf_to_base64_images(): Convert PDFs to base64 for LLM processing
Requirements
- Python 3.8+
- langchain-openai
- langchain-anthropic
- langchain-core
- PyMuPDF
- Pillow
- pillow-heif
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Release files for agi-agents 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agi_agents-1.0.2.tar.gz | 24.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agi_agents-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.8 kB
Release files / agi_agents-1.0.2.tar.gz
| Download URL | agi_agents-1.0.2.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27aa1b93f81544bc4aeaf008ce7f95c590a71199a7a1aa16873e0dfea14b56f4
|
|
BLAKE2b-256 checksum How to use checksums |
77e7f2912207a67ec71ed2c2dde7bd07f944c3a7276ce1c8960f4b268c3e1c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / agi_agents-1.0.2-py3-none-any.whl
| Download URL | agi_agents-1.0.2-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7bf9004a0e7cf7331ddfb0907d02d4e6863bc82a0dfcbb45ef52aa77e1c6103c
|
|
BLAKE2b-256 checksum How to use checksums |
c85b47291095b4f12082d91616b6f498382f2deb3e405caba9f7fd9bd5ad3876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|