Beyond the event payload argument into your automation, 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 automation 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"])

@task(name="hello-world")
@on("github.pull_request)
def my_task(event, config: Config):
    print(config.prompt)

When your automation is registered, we generate a dynamic form from your Pydantic model schema. The owner as well any public installers will be able to edit the configuration from the dashboard.