nikitas-agents
Provider-agnostic wrappers around OpenAI and Mistral SDKs to power LLM-based agents in games or simulations.
Installation
This package is currently distributed straight from GitHub:
pip install git+https://github.com/NikitaDmitrieff/nikitas-agents.git
Quick Start
from nikitas_agents.agents import BaseAgent
agent = BaseAgent(
name="Strategist",
description="Keeps track of board state",
provider="openai",
model="gpt-4o-mini",
)
reply = agent.invoke("Give me one word hint.")
print(reply)
Set OPENAI_API_KEY or MISTRAL_API_KEY in your environment before invoking agents.
Features
- Multi-provider support: Works with both OpenAI and Mistral APIs
- Model validation: Ensures you're using supported models for each provider
- Environment-based configuration: Automatically loads API keys from environment variables
- Flexible prompting: Support for both system and user prompts with customizable parameters
Supported Providers and Models
OpenAI
- gpt-4o-mini
- gpt-4o
- gpt-4-turbo
- gpt-4
- gpt-3.5-turbo
Mistral
- mistral-small-latest
- mistral-medium-latest
- mistral-large-latest
- mistral-tiny
- open-mistral-7b
- open-mixtral-8x7b
- open-mixtral-8x22b
Usage
Basic Agent Creation
from nikitas_agents import BaseAgent
# Create an OpenAI agent
openai_agent = BaseAgent(
name="Assistant",
description="A helpful assistant",
provider="openai",
model="gpt-4o-mini"
)
# Create a Mistral agent
mistral_agent = BaseAgent(
name="Strategist",
description="A strategic thinking agent",
provider="mistral",
model="mistral-small-latest"
)
Advanced Usage
response = agent.invoke(
user_prompt="What's the best strategy for this situation?",
system_prompt="You are an expert game strategist",
temperature=0.7,
max_output_tokens=512,
timeout=30.0
)
Provider and Model Validation
from nikitas_agents import schema
# Check supported providers
providers = schema.supported_providers()
print(providers) # {'openai', 'mistral'}
# Check supported models for a provider
models = schema.supported_models('openai')
print(models) # {'gpt-4o-mini', 'gpt-4o', ...}
# Validate a provider/model combination
validated_model = schema.validate_model('openai', 'gpt-4o-mini')
Environment Setup
Create a .env file in your project root:
OPENAI_API_KEY=your_openai_api_key_here
MISTRAL_API_KEY=your_mistral_api_key_here
Or set environment variables directly:
export OPENAI_API_KEY="your_openai_api_key_here"
export MISTRAL_API_KEY="your_mistral_api_key_here"
Development
To contribute to this project:
- Clone the repository
- Install in development mode:
pip install -e . - Run tests:
python -m pytest tests/
License
MIT License - see LICENSE file for details.
Metadata
Release files for nikitas-agents 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nikitas_agents-0.1.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nikitas_agents-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / nikitas_agents-0.1.0.tar.gz
| Download URL | nikitas_agents-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffb99622212d4957226a738c53408071ecebb77bf41e7c6367a53ff9e15df624
|
|
BLAKE2b-256 checksum How to use checksums |
ab11512b3d39352b5f4ebe89b381bc4710ae0f7f91d4d2263ff0ef6cdbd6c399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / nikitas_agents-0.1.0-py3-none-any.whl
| Download URL | nikitas_agents-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed5159235c9033c4e9a98dc348555f49127d5627d15869b96124b2f1262482f2
|
|
BLAKE2b-256 checksum How to use checksums |
e85c23e839177373bb1b3b54187071dcd9034a3fdacf040092b48ddfc6fb81d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|