Skip to main content

Prompt Construction

run_agent does not use the old stage-level prompt-template file. Build prompts directly in Python and pass them to run_agent(prompt=...).

Basic Prompt

from abstra.ai import run_agent
from abstra.tasks import get_trigger_task

task = get_trigger_task()

run_agent(
prompt=f"""
You received a support request from {task.payload.get("customer_name")}.
Their message: {task.payload.get("message")}

Please categorize this request and draft a response.
""",
)

Using Multiple Prompt Inputs

You can pass a list to combine text and files/images:

from abstra.ai import run_agent

run_agent(
prompt=[
"Summarize this invoice and flag suspicious values.",
"./invoice.pdf",
]
)

Tips

  • Keep prompts explicit about objective, constraints, and expected output.
  • Inject workflow/task context with Python variables (f-strings or string builders).
  • Prefer short, structured instructions for more predictable behavior.