The easiest way to build AI agents in Python
Project description
Axcent
The easiest way to build AI agents in Python.
Axcent is a lightweight framework designed to let you build powerful AI agents with tool calling, context caching, and multi-backend support in just a few lines of code.
Installation
pip install axcent
To use Gemini models:
pip install axcent[gemini]
Quick Start (OpenAI)
import os
from axcent import Agent
# Set your API Key
os.environ["OPENAI_API_KEY"] = "sk-..."
# Initialize Agent
agent = Agent(system_prompt="You are a helpful assistant.")
# Register a Tool
@agent.tool
def get_weather(city: str) -> str:
"""Returns weather info for a city."""
return f"The weather in {city} is sunny!"
# Ask away!
response = agent.ask("What is the weather in Tokyo?")
print(response)
Features
- Simple Tool Registration: Just use
@agent.tool. - Automatic Context Caching: Optimizes token usage by enforcing stable prompt structures.
- Token Monitoring: Track prompt, completion, and cached tokens via
agent.get_total_usage(). - Multimodal Support: Process images and audio with the
Transcriberclass. - Backend Agnostic:
- OpenAI: First-class support with vision.
- Google Gemini: Support for all latest models including multimodal.
- OpenRouter: Use any model via OpenRouter API compatibility.
Multimodal: Images & Audio
Axcent v0.3.0 introduces multimodal capabilities. Use the Transcriber class to let your agent "see" images and "hear" audio.
from axcent import Agent, Transcriber
from axcent.llm import GeminiBackend
agent = Agent(system_prompt="You are a helpful assistant.")
@agent.tool
def see_media(path: str) -> str:
"""Analyze an image or audio file."""
transcriber = Transcriber(
system_prompt="Describe this media briefly.",
backend=GeminiBackend()
)
return transcriber.transcribe_file(path)
# Now the agent can understand media files!
response = agent.ask("What's in /path/to/image.jpg?")
You can also send images/audio directly with ask():
from axcent import Agent, Image
agent = Agent(model="gpt-4o") # Vision-capable model
img = Image(url="https://example.com/photo.jpg")
response = agent.ask("What's in this image?", media=[img])
Multi-Backend Usage
Google Gemini
from axcent import Agent, GeminiBackend
import os
# Set API Key (or GOOGLE_API_KEY)
os.environ["GEMINI_API_KEY"] = "AIza..."
# Use Gemini Backend (uses google-genai V2 SDK)
backend = GeminiBackend(model="gemini-3-flash")
agent = Agent(system_prompt="You are a helper.", backend=backend)
OpenRouter
import os
from axcent import Agent
os.environ["OPENAI_API_KEY"] = "sk-or-..."
os.environ["OPENAI_BASE_URL"] = "https://openrouter.ai/api/v1"
agent = Agent(system_prompt="You are a helper.")
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file axcent-0.4.0.tar.gz.
File metadata
- Download URL: axcent-0.4.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b12841f09f4b1e1b3cde069318993a66965b3bbe8adacf26a3526d064574ed7
|
|
| MD5 |
c7986520053d2da4fcf0e465ac57ebb7
|
|
| BLAKE2b-256 |
8f6bff09e442b1f3e310a9d9fd67d69e68f1f6cab4b21c4cb46664cfac9e4322
|
File details
Details for the file axcent-0.4.0-py3-none-any.whl.
File metadata
- Download URL: axcent-0.4.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15b119c7eab93b33d6dc82de7e6eddf60154ede9149a710a48a992ab0bcc9caa
|
|
| MD5 |
fcef5ee7c11af4b4e402e3c420897056
|
|
| BLAKE2b-256 |
aef53dc83b89f32f1aae9f14bb129d89b11dffa3298992de635222a860423858
|