| Crates.io | bevy-agent |
| lib.rs | bevy-agent |
| version | 0.1.0 |
| created_at | 2025-07-22 15:54:27.01494+00 |
| updated_at | 2025-07-22 15:54:27.01494+00 |
| description | AI-powered Bevy game development assistant with GPT/Claude integration |
| homepage | https://github.com/jbuehler23/bevy-agent |
| repository | https://github.com/jbuehler23/bevy-agent |
| max_upload_size | |
| id | 1763638 |
| size | 327,342 |
Bevy AI Agent is a comprehensive library and CLI tool that leverages cutting-edge AI models (GPT-4, Claude-3, Gemini) to accelerate Bevy game development through natural language code generation, intelligent feature addition, and automated code optimization.
cargo install bevy-agent
Add to your Cargo.toml:
[dependencies]
bevy-agent = "0.1.0"
tokio = { version = "1.0", features = ["full"] }
# Configure OpenAI (recommended)
bevy-agent config --openai-key sk-...
# Or use Anthropic
bevy-agent config --anthropic-key ant-...
# Or use Google
bevy-agent config --google-key AIz...
# Set default model
bevy-agent config --default-model gpt-4
# Create a 2D platformer
bevy-agent create "2D platformer with physics and collectibles"
# Create a 3D space shooter
bevy-agent create "3D space shooter with asteroids and power-ups"
# Create a puzzle game
bevy-agent create "puzzle game with grid-based mechanics and level progression"
cd your-game-project
bevy-agent add "inventory system with drag-and-drop UI"
bevy-agent add "magic system with spell combinations and cooldowns"
bevy-agent add "multiplayer support with networking"
# Improve performance
bevy-agent improve performance
# Enhance readability
bevy-agent improve readability
# Add better structure
bevy-agent improve structure
# Roguelike with procedural generation
bevy-agent create "roguelike dungeon crawler with procedural generation, turn-based combat, and character progression"
# Physics-based puzzle game
bevy-agent create "physics-based puzzle game like Portal with teleportation mechanics and environmental puzzles"
# Tower defense with AI
bevy-agent create "tower defense with pathfinding enemies, upgradeable towers, and resource management"
# Use specific models for different tasks
bevy-agent create "space game" --model gpt-4
bevy-agent add "multiplayer" --model claude-3-opus
bevy-agent improve performance --model gpt-4-turbo
# Get AI explanations of your codebase
bevy-agent explain
# Debug specific issues
bevy-agent debug "compilation error in movement system"
# Analyze specific files
bevy-agent explain --file src/player.rs
# View project information
bevy-agent project info
# Show project statistics
bevy-agent project stats
# View AI conversation history
bevy-agent project history
# Clean up generated files
bevy-agent project clean
# Build your game
bevy-agent build build
# Run your game
bevy-agent build run
# Check for errors
bevy-agent build check
# Run clippy lints
bevy-agent build clippy
# Format code
bevy-agent build format
# List available templates
bevy-agent template list
# Show template details
bevy-agent template show platformer_2d
# Create game from template
bevy-agent create "my platformer" --template platformer_2d
use bevy_agent::{BevyAIAgent, AIConfig, ModelType};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AIConfig::from_env()?;
let agent = BevyAIAgent::new(config).await?;
let response = agent
.generate_game("A simple 2D shooter")
.with_model(ModelType::GPT4)
.execute()
.await?;
println!("Generated code:\n{}", response.content);
Ok(())
}
use bevy_agent::{Project, BevyAIAgent, AIConfig};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AIConfig::load_or_create()?;
let agent = BevyAIAgent::new(config).await?;
// Create a new project
let mut project = Project::init(
PathBuf::from("my-game"),
"My Awesome Game",
"A revolutionary puzzle platformer",
agent
).await?;
// Generate initial game code
let response = project.generate_game(
"2D puzzle platformer with physics-based mechanics"
).await?;
// Add features
project.add_feature("inventory system with crafting").await?;
project.add_feature("save/load system").await?;
// Build the project
project.manager().build().await?;
Ok(())
}
use bevy_agent::{BevyAIAgent, AIConfig, ModelType};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AIConfig::from_env()?;
let agent = BevyAIAgent::new(config).await?;
let response = agent
.request("Create a component for enemy AI behavior")
.with_model(ModelType::Claude3Opus)
.with_temperature(0.8)
.with_max_tokens(2000)
.with_context("This is for a 2D tower defense game")
.execute()
.await?;
println!("AI Response: {}", response.content);
Ok(())
}
bevy-agent create "metroidvania with ability-gated progression, interconnected world, and backtracking mechanics"
Generates:
bevy-agent add "dialogue system with branching conversations, character portraits, and voice acting support"
Creates:
bevy-agent add "A* pathfinding for enemy AI with dynamic obstacle avoidance"
Implements:
Bevy AI stores configuration in ~/.bevy-agent-config.json:
{
"openai": {
"api_key": "sk-...",
"organization": null,
"base_url": null
},
"anthropic": {
"api_key": "ant-...",
"base_url": null
},
"google": {
"api_key": "AIz...",
"base_url": null
},
"default_model": "gpt-4",
"generation": {
"temperature": 0.7,
"max_tokens": 4000,
"include_comments": true,
"generate_tests": false,
"bevy_version": "0.12",
"rust_edition": "2021"
},
"project": {
"track_conversations": true,
"auto_format": true,
"auto_dependencies": true,
"default_template": "basic"
}
}
You can also configure using environment variables:
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="ant-..."
export GOOGLE_API_KEY="AIz..."
export bevy_agent_DEFAULT_MODEL="gpt-4"
Each Bevy AI project includes a .bevy-agent.json file that tracks:
AI Integration Layer (src/ai/)
Project Management (src/project.rs)
Template System (src/game_templates.rs)
CLI Interface (src/cli.rs)
Utilities (src/utils.rs)
| Provider | Models | Context Length | Strengths |
|---|---|---|---|
| OpenAI | GPT-4, GPT-4-Turbo, GPT-3.5-turbo | 8K-128K | Code generation, debugging |
| Anthropic | Claude-3-opus, Claude-3-sonnet, Claude-3-haiku | 200K | Long context, reasoning |
| Gemini-pro, Gemini-pro-vision | 32K | Multimodal, fast inference |
We welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/jbuehler23/bevy-agent.git
cd bevy-agent
cargo build
cargo test
# Set up API keys
export OPENAI_API_KEY="your-key-here"
# Run CLI examples
cargo run -- create "simple platformer"
cargo run -- add "particle effects"
cargo run -- improve performance
This project is licensed under either of
at your option.
This project is actively developed and maintained. We aim to support the latest versions of Bevy and provide cutting-edge AI integration for game development.
Current Status: