Python API Configuration
Basic Agent Setup
YAML Configuration
Basic YAML Config
Schema Configuration
Define reusable schemas for structured responses in your agent:Schema File Formats
JSON Schema Files
Create structured data models using JSON Schema:Python Schema Files
Define models using Pydantic classes:Schema Referencing
Reference schemas in your step configurations:Schema Benefits
Reusability
Use schemas across multiple agents and steps
Maintainability
Update schemas without changing agent configuration
Type Safety
Full validation with detailed error messages
Version Control
Track schema changes separately
Advanced YAML Configuration
Barista Agent Example
See a comprehensive configuration example
Server Configuration
Configure the FastAPI server settings and security features:Security Configuration Examples
Important Security Warning: Token Generation EndpointThe
/auth/token
endpoint is automatically exposed when JWT authentication is enabled. This endpoint allows generating JWT tokens for testing purposes and should never be available in production environments.Security measures in place:- It requires the
enable_token_endpoint
configuration option to be set totrue
in development or testing configurations. - It should be disabled or removed in production deployments
- Validates user credentials properly
- Uses secure session management
- Implements proper user authentication flows
- Issues tokens with appropriate expiration times
- Logs authentication attempts for security monitoring
LLM Configuration
Supported Providers
YAML LLM Configuration
Generate YAML Schema
Create a JSON schema for your configuration to enable editor validation and autocompletion:Tool Configuration
New in v0.2.4: You can now specify tools directly in your agent configuration file
Custom Tool Files
You can organize your own tools in Python modules:Tool Loading Options
- Configuration File (Recommended)
- CLI Flags (Legacy)
Step Examples
You can provide decision examples for any step. Each example contains the user context and the expected decision. NOMOS retrieves relevant examples using embeddings and includes them in the system prompt to guide the model.max_examples
and threshold
settings in AgentConfig
to control how many examples are displayed and the minimum similarity required.
Error Handling Configuration
Environment Variables
Common environment variables for NOMOS agents:Variable | Description | Required |
---|---|---|
OPENAI_API_KEY | OpenAI API key | If using OpenAI |
MISTRAL_API_KEY | Mistral API key | If using Mistral |
GOOGLE_API_KEY | Google API key | If using Gemini |
HUGGINGFACE_API_TOKEN | HuggingFace token | If using HuggingFace |
ANTHROPIC_API_KEY | Anthropic API key | If using Anthropic |
JWT_SECRET_KEY | JWT secret key | If using JWT authentication |
CSRF_SECRET_KEY | CSRF secret key | If using CSRF protection |
API_KEY_VALIDATION_URL | API key validation endpoint URL | If using API key authentication |
DATABASE_URL | Database connection URL | If using production session store |
REDIS_URL | Redis connection URL | If using Redis for sessions |
KAFKA_BROKERS | Kafka broker URLs | If using Kafka for events |
Using Environment Variables in Configuration
You can reference environment variables in your YAML configuration using the$
prefix:
Variable | Description | Required |
---|---|---|
OPENAI_API_KEY | OpenAI API key | If using OpenAI |
MISTRAL_API_KEY | Mistral API key | If using Mistral |
GOOGLE_API_KEY | Google API key | If using Gemini |
HUGGINGFACE_API_TOKEN | HuggingFace token | If using HuggingFace |
ANTHROPIC_API_KEY | Anthropic API key | If using Anthropic |