Agents
Abstra Agents are now used as a function call, not as a workflow stage.
Use run_agent from abstra.ai inside a regular Python stage (typically a Tasklet).
from abstra.ai import run_agent
from abstra.tasks import get_trigger_task
task = get_trigger_task()
result = run_agent(
prompt=f"""
You are a customer support agent.
Customer: {task.payload.get("customer_name")}
Request: {task.payload.get("request")}
Classify this request and propose a response.
""",
max_steps=30,
)
print(result)
How It Works Now
- A stage script calls
run_agent(...). - The prompt is sent to the LLM runtime.
- The agent runs a reasoning loop and can call any tool you expose.
- The run ends when it finishes or reaches
max_steps.
Migration Notes
- Old Agent Stage: removed.
- Old prompt-template markdown (
.md+ Jinja2): replace with Python strings (usually f-strings). - Old permission picker: replace with
tools=[...]passed torun_agent.
See:
When to Use run_agent
Use it when the process requires non-deterministic reasoning and tool selection, such as:
- Working with unstructured content (emails, documents, screenshots)
- Multi-step tasks where each next action depends on previous results
- Context-dependent routing/triage decisions
For fixed logic with deterministic steps, a regular Tasklet script is usually simpler.