Production-ready examples with complete configurations, properties, and performance results
A basic conversational agent deployment with session management, HTTP endpoints, and cost optimization. Perfect for customer support, virtual assistants, or general Q&A applications.
apiVersion: neuronetes.io/v1alpha1
kind: Model
metadata:
name: llama-3-8b-chat
namespace: default
spec:
weightsURI: s3://models/llama-3-8b-instruct/
size: 16Gi
quantization: int8
architecture: llama
parameterCount: "8B"
format: safetensors
cachePolicy:
priority: medium
pinDuration: 1h
evictionPolicy: lru
apiVersion: neuronetes.io/v1alpha1
kind: AgentClass
metadata:
name: chat-assistant
namespace: default
spec:
modelRef:
name: llama-3-8b-chat
maxContextLength: 8192
systemPrompt: |
You are a helpful, friendly AI assistant. Provide clear,
concise, and accurate responses. Be conversational but professional.
temperature: 0.8
maxTokens: 2048
guardrails:
- type: pii-detection
action: redact
threshold: 0.8
- type: safety-check
action: block
threshold: 0.9
slo:
ttft: 300ms
tokensPerSecond: 75
p95Latency: 1s
memoryConfig:
type: ephemeral
ttl: 30m
maxSize: 5000
apiVersion: neuronetes.io/v1alpha1
kind: AgentPool
metadata:
name: chat-pool
namespace: default
spec:
agentClassRef:
name: chat-assistant
minReplicas: 3
maxReplicas: 30
prewarmPercent: 30
migProfile: "1g.5gb"
autoscaling:
metrics:
- type: concurrent-sessions
target: "100"
- type: ttft-p95
target: "300ms"
behavior:
scaleUp:
stabilizationWindow: 30s
maxChangeAbsolute: 5
scaleDown:
stabilizationWindow: 180s
maxChangeAbsolute: 2
sessionAffinity:
enabled: true
keyHeader: "X-Session-ID"
ttl: 30m
type: conversation-id
scheduling:
costOptimization:
enabled: true
spotEnabled: true
maxCostPerHour: 30.0
# Get the endpoint
ENDPOINT=$(kubectl get svc neuronetes-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
# Send a request
curl -X POST http://$ENDPOINT/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-Session-ID: test-session-123" \
-d '{
"messages": [
{
"role": "user",
"content": "Hello! Can you help me understand quantum computing?"
}
],
"stream": false
}'
import requests
def chat(message, session_id="default"):
response = requests.post(
f"http://{ENDPOINT}/v1/chat/completions",
headers={
"Content-Type": "application/json",
"X-Session-ID": session_id
},
json={
"messages": [{"role": "user", "content": message}],
"stream": False
}
)
return response.json()
# Usage
result = chat("What is the weather like today?", "user-123")
print(result["choices"][0]["message"]["content"])
A complete agent deployment with RAG (Retrieval-Augmented Generation) for code assistance, featuring multiple tools, queue-based task processing, and session-based state management.
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Client βββββββΆβ Ingress βββββββΆβ Agent β
β (VSCode) ββββββββ (HTTP) ββββββββ Pool β
βββββββββββββββ ββββββββββββββββ βββββββ¬ββββββββ
β
ββββββββββββββββ β
β Task Queue βββββββββββββββ€
β (NATS) β β
ββββββββββββββββ β
β
ββββββββββββββββ β
βVector Store βββββββββββββββ€
β (Weaviate) β β
ββββββββββββββββ β
β
ββββββββββββββββ β
βSession Store βββββββββββββββ
β (Redis) β
ββββββββββββββββ
apiVersion: neuronetes.io/v1alpha1
kind: AgentClass
metadata:
name: code-assistant
spec:
modelRef:
name: llama-3-70b
maxContextLength: 128000
systemPrompt: |
You are an expert code assistant. Help developers with:
- Code review and suggestions
- Bug fixing and debugging
- Documentation generation
- Code search and navigation
Use the available tools to access the codebase.
toolPermissions:
- name: code-search
rateLimit: 100/min
timeout: 5s
maxConcurrency: 3
requiredScopes:
- read:code
- name: file-read
rateLimit: 50/min
timeout: 2s
maxConcurrency: 2
requiredScopes:
- read:files
guardrails:
- type: pii-detection
action: redact
- type: code-injection-check
action: block
slo:
ttft: 500ms
tokensPerSecond: 50
p95Latency: 2s
A production-ready retrieval-augmented generation setup with vector store, embedding model, and data locality optimization for maximum performance.
apiVersion: neuronetes.io/v1alpha1
kind: AgentClass
metadata:
name: rag-agent
namespace: rag-system
spec:
modelRef:
name: llama-3-70b-rag
maxContextLength: 128000
systemPrompt: |
You are a helpful assistant with access to a knowledge base.
When answering questions:
1. Use the retrieve tool to find relevant information
2. Cite sources from the retrieved documents
3. Be accurate and admit when you don't know
4. Synthesize information from multiple sources
Format citations as [Source: document_id].
toolPermissions:
- name: retrieve
rateLimit: "50/min"
timeout: 5s
maxConcurrency: 3
config:
top_k: 5
rerank: true
cache_ttl: 300
- name: rerank
rateLimit: "30/min"
timeout: 2s
slo:
ttft: 800ms
tokensPerSecond: 45
p95Latency: 3s
apiVersion: neuronetes.io/v1alpha1
kind: AgentPool
metadata:
name: rag-pool
namespace: rag-system
spec:
agentClassRef:
name: rag-agent
minReplicas: 3
maxReplicas: 15
scheduling:
priority: 90
# Co-locate with vector store for low latency
dataLocality:
vectorStoreAffinity:
- weaviate
cacheAffinity:
- redis
costOptimization:
enabled: true
spotEnabled: true
sloHeadroomMs: 1500
import requests
def rag_query(question, session_id=None):
"""Query the RAG system"""
response = requests.post(
"http://rag-http.rag-system/v1/rag/query",
headers={
"Content-Type": "application/json",
"X-Session-ID": session_id or "default"
},
json={
"messages": [
{
"role": "user",
"content": question
}
],
"stream": False,
"retrieval_config": {
"top_k": 5,
"rerank": True
}
}
)
return response.json()
# Example usage
result = rag_query(
"What are the best practices for Kubernetes security?",
session_id="user-123"
)
print(result["choices"][0]["message"]["content"])
print(f"Sources used: {result['metadata']['sources_used']}")
| Feature | Chat Agent | Code Assistant | RAG Pipeline |
|---|---|---|---|
| Model Size | 8B | 70B | 70B |
| TTFT P95 | 245ms | 450ms | 720ms |
| Throughput | 82 tok/s | 55 tok/s | 48 tok/s |
| GPU Memory | 16GB | 140GB | 140GB |
| Cost/1K tokens | $0.02 | $0.15 | $0.18 |
| Tools | None | 2 | 2 |
| Use Case | General chat | Code help | Knowledge Q&A |