Skip to content

Quick Start

gitpavleenbali edited this page Feb 17, 2026 · 4 revisions

Quick Start

Get up and running with PYAI in 5 minutes.

Installation

pip install pyai

For Azure OpenAI with Azure AD authentication:

pip install pyai[azure]

Configuration

Set your API keys:

# OpenAI
export OPENAI_API_KEY=sk-your-key

# Azure OpenAI (uses Azure AD - no API key needed!)
export AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
export AZURE_OPENAI_DEPLOYMENT=gpt-4o-mini

Hello World

One-Liner API

from pyai import ask

answer = ask("What is the capital of France?")
print(answer)  # Paris

Agent with Tools

from pyai import Agent, Runner
from pyai.skills import tool

@tool(description="Get weather for a city")
async def get_weather(city: str) -> str:
    return f"Weather in {city}: Sunny, 72Β°F"

agent = Agent(
    name="WeatherBot",
    instructions="Help users with weather information.",
    tools=[get_weather]
)

result = Runner.run_sync(agent, "What's the weather in Tokyo?")
print(result.final_output)

RAG in 2 Lines

from pyai import rag

docs = rag.index("./documents")
answer = docs.ask("What is the main conclusion?")

Next Steps

🧠 PYAI Wiki

Home


πŸš€ Getting Started


πŸ’‘ Core Concepts


🎯 One-Liner APIs


πŸ€– Agent Framework


πŸ”— Multi-Agent


πŸ› οΈ Tools & Skills


🏒 Enterprise


πŸŽ™οΈ Voice


πŸ–ΌοΈ Multimodal


πŸ“Š Vector DB


🌐 OpenAPI


πŸ”Œ Plugins


🀝 A2A Protocol


πŸ”’ Security


πŸ“š Reference


Intelligence, Embedded.

Clone this wiki locally