Creating and Running Tasks
The most convenient way to run a task is with themarvin.run() function. This function creates and runs a task in a single call, accepting all the same arguments as the Task constructor:
Running a Single Task
You can also create a task first and run it later using therun() method:
Running Multiple Tasks
To run multiple tasks at once, use therun_tasks() function:
Task Dependencies
Tasks can depend on other tasks, ensuring they run in the correct order:- Check if there are any dependencies
- Run any incomplete dependencies first
- Execute the task itself
- Return the result
Task Results
Tasks can specify their expected result type using theresult_type parameter:
Task Status
You can check a task’s status at any time:is_pending(): Task hasn’t startedis_running(): Task is currently executingis_successful(): Task completed successfullyis_failed(): Task failed to completeis_skipped(): Task was skippedis_complete(): Task is done (successful, failed, or skipped)is_incomplete(): Task isn’t done (pending or running)is_ready(): Task can be run (dependencies are complete)
Task Context
Tasks maintain their own context, which can include:- Instructions: What needs to be done
- Context: Additional information needed for the task
- Tools: Functions the agent can use
- Memories: Persistent information from previous runs
- Result type: Expected format of the output
