Agents
Learn how to create, configure, and manage intelligent agents in OACP with adaptive prompting capabilities.
Creating Agents
Agents are the core building blocks of OACP. Each agent has a specific role and can adapt its behavior over time.
from oacp import Agent
# Create a basic agent
agent = Agent(
name="researcher",
role="Research and gather information on given topics",
model="gpt-4",
temperature=0.7
)
# Create an agent with custom prompting
agent = Agent(
name="analyst",
role="Analyze data and provide insights",
system_prompt="You are an expert data analyst...",
adaptive_prompting=True
)Agent Configuration
Basic Parameters
| Parameter | Type | Description |
|---|---|---|
name | str | Unique identifier for the agent |
role | str | Description of the agent's purpose |
model | str | LLM model to use (default: gpt-3.5-turbo) |
temperature | float | Creativity level (0.0-1.0) |
Adaptive Prompting
OACP agents can learn and improve their prompts based on interaction history and feedback.
# Enable adaptive prompting
agent = Agent(
name="adaptive_researcher",
role="Research specialist",
adaptive_prompting=True,
learning_rate=0.1,
feedback_threshold=5
)
# The agent will automatically improve its prompts based on:
# - Success/failure of tasks
# - User feedback
# - Peer agent evaluations
# - Performance metricsAgent Interactions
# Direct agent interaction
response = agent.process("What are the latest trends in AI?")
# Agent-to-agent communication
message = agent.send_message(other_agent, "Please review this analysis")
# Batch processing
results = agent.process_batch([
"Task 1: Research topic A",
"Task 2: Research topic B",
"Task 3: Research topic C"
])Best Practices
Clear Role Definition
Define specific, focused roles for each agent to avoid overlap and improve coordination.
Enable Adaptive Learning
Use adaptive prompting for agents that perform repetitive tasks to improve over time.
Monitor Performance
Regularly review agent performance metrics and adjust configurations as needed.