Documentation Index
Fetch the complete documentation index at: https://docs.blocks.team/llms.txt
Use this file to discover all available pages before exploring further.
Beyond the event payload argument into your agent, you can also accept a second optional argument: config. The config should be a Pydantic model that you define, which can hold configurable state for your agent such as prompts, Sentry project to Github project mappings, and so on.
Example
from blocks import task
from pydantic import BaseModel, Field
class SentryToRepoMapping(BaseModel):
sentry_id: str
repo: str
class Config(BaseModel):
sentry_id_to_repo_map: List[SentryToRepoMapping] = Field(default=[])
prompt: str = Field(default="""
This is an example prompt.
## Directory Structure:
{directory_listing}
## Files Changed:
{files_changed_listing}
""", required=True, required_fields=["directory_listing", "files_changed_listing"])
@agent(name="hello-world")
@on("github.pull_request)
def my_task(event, config: Config):
print(config.prompt)
When your agent is registered, we generate a dynamic form from your Pydantic model schema. You can edit the configuration state on the agent page.