Skip to content

Instantly share code, notes, and snippets.

@r0x0d
Created November 4, 2025 13:46
Show Gist options
  • Select an option

  • Save r0x0d/1c8208fa2b2eed775b78cb035864db22 to your computer and use it in GitHub Desktop.

Select an option

Save r0x0d/1c8208fa2b2eed775b78cb035864db22 to your computer and use it in GitHub Desktop.
example.py
ChatCompletionRequest(
messages=[
ChatMessage(
role="system",
content="You are a general-purpose AI agent called goose, created by Block, the parent company of Square, CashApp, and Tidal.\ngoose is being developed as an open-source software project.\n\nThe current date is 2025-11-04 12:00.\n\ngoose uses LLM providers with tool calling capability. You can be used with different language models (gpt-4o,\nclaude-sonnet-4, o1, llama-3.2, deepseek-r1, etc).\nThese models have varying knowledge cut-off dates depending on when they were trained, but typically it's between 5-10\nmonths prior to the current date.\n\n# Extensions\n\nExtensions allow other applications to provide context to goose. Extensions connect goose to different data sources and\ntools.\nYou are capable of dynamically plugging into new extensions and learning how to use them. You solve higher level\nproblems using the tools in these extensions, and can interact with multiple at once.\n\nIf the Extension Manager extension is enabled, you can use the search_available_extensions tool to discover additional\nextensions that can help with your task. To enable or disable extensions, use the manage_extensions tool with the\nextension_name. You should only enable extensions found from the search_available_extensions tool.\nIf Extension Manager is not available, you can only work with currently enabled extensions and cannot dynamically load\nnew ones.\n\nNo extensions are defined. You should let the user know that they should add extensions.\n\n\n\n\n# Response Guidelines\n\n- Use Markdown formatting for all responses.\n- Follow best practices for Markdown, including:\n - Using headers for organization.\n - Bullet points for lists.\n - Links formatted correctly, either as linked text (e.g., [this is linked text](https://example.com)) or automatic\n links using angle brackets (e.g., <http://example.com/>).\n- For code examples, use fenced code blocks by placing triple backticks (` ``` `) before and after the code. Include the\n language identifier after the opening backticks (e.g., ` ```python `) to enable syntax highlighting.\n- Ensure clarity, conciseness, and proper formatting to enhance readability and usability.\n\n# Additional Instructions:\n\nYou are being accessed through a command-line interface. The following slash commands are available\n- you can let the user know about them if they need help:\n\n- /exit or /quit - Exit the session\n- /t - Toggle between Light/Dark/Ansi themes\n- /? or /help - Display help message\n\nAdditional keyboard shortcuts:\n- Ctrl+C - Interrupt the current interaction (resets to before the interrupted request)\n- Ctrl+J - Add a newline\n- Up/Down arrows - Navigate command history",
tool_calls=None,
tool_call_id=None,
name=None,
),
ChatMessage(
role="user",
content="how much is 1+1?",
tool_calls=None,
tool_call_id=None,
name=None,
),
],
stream=True,
tools=[
Tool(
type="function",
function=ToolFunction(
name="dynamic_task__create_task",
description="Create tasks with instructions or prompt. For simple tasks, only include the instructions field. Extensions control: omit field = use all current extensions; empty array [] = no extensions; array with names = only those extensions. Specify extensions as shortnames (the prefixes for your tools). Specify return_last_only as true and have your subagent summarize its work in its last message to conserve your own context. Optional: title, description, extensions, settings, retry, response schema, context, activities. Arrays for multiple tasks.",
parameters={
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "CreateDynamicTaskParams",
"type": "object",
"properties": {
"task_parameters": {
"description": "Array of tasks. Each task must have either 'instructions' OR 'prompt' field (at least one is required).",
"type": "array",
"items": {"$ref": "#/$defs/TaskParameter"},
"minItems": 1,
},
"execution_mode": {
"description": "How to execute multiple tasks (default: parallel for multiple tasks, sequential for single task)",
"type": ["string", "null"],
},
},
"required": ["task_parameters"],
"$defs": {
"TaskParameter": {
"description": "Parameters for a single task",
"type": "object",
"properties": {
"instructions": {"type": ["string", "null"]},
"prompt": {"type": ["string", "null"]},
"title": {"type": ["string", "null"]},
"description": {"type": ["string", "null"]},
"extensions": {
"type": ["array", "null"],
"items": {
"type": "object",
"additionalProperties": True,
},
},
"settings": {
"type": ["object", "null"],
"additionalProperties": True,
},
"parameters": {
"type": ["array", "null"],
"items": {
"type": "object",
"additionalProperties": True,
},
},
"response": {
"type": ["object", "null"],
"additionalProperties": True,
},
"retry": {
"type": ["object", "null"],
"additionalProperties": True,
},
"context": {
"type": ["array", "null"],
"items": {"type": "string"},
},
"activities": {
"type": ["array", "null"],
"items": {"type": "string"},
},
"return_last_only": {
"description": "If true, return only the last message from the subagent (default: false, returns full conversation)",
"type": ["boolean", "null"],
},
},
}
},
},
),
),
Tool(
type="function",
function=ToolFunction(
name="platform__manage_schedule",
description='Manage scheduled recipe execution for this goose instance.\n\nActions:\n- "list": List all scheduled jobs\n- "create": Create a new scheduled job from a recipe file\n- "run_now": Execute a scheduled job immediately \n- "pause": Pause a scheduled job\n- "unpause": Resume a paused job\n- "delete": Remove a scheduled job\n- "kill": Terminate a currently running job\n- "inspect": Get details about a running job\n- "sessions": List execution history for a job\n- "session_content": Get the full content (messages) of a specific session\n',
parameters={
"type": "object",
"required": ["action"],
"properties": {
"action": {
"type": "string",
"enum": [
"list",
"create",
"run_now",
"pause",
"unpause",
"delete",
"kill",
"inspect",
"sessions",
"session_content",
],
},
"job_id": {
"type": "string",
"description": "Job identifier for operations on existing jobs",
},
"recipe_path": {
"type": "string",
"description": "Path to recipe file for create action",
},
"cron_expression": {
"type": "string",
"description": "A cron expression for create action. Supports both 5-field (minute hour day month weekday) and 6-field (second minute hour day month weekday) formats. 5-field expressions are automatically converted to 6-field by prepending '0' for seconds.",
},
"limit": {
"type": "integer",
"description": "Limit for sessions list",
"default": 50,
},
"session_id": {
"type": "string",
"description": "Session identifier for session_content action",
},
},
},
),
),
Tool(
type="function",
function=ToolFunction(
name="subagent__execute_task",
description="Only use the subagent__execute_task tool when you execute sub recipe task or dynamic task.\n EXECUTION STRATEGY DECISION:\n 1. If the tasks are created with execution_mode, use the execution_mode.\n 2. Execute tasks sequentially unless user explicitly requests parallel execution. PARALLEL: User uses keywords like 'parallel', 'simultaneously', 'at the same time', 'concurrently'\n\n IMPLEMENTATION:\n - Sequential execution: Call this tool multiple times, passing exactly ONE task per call\n - Parallel execution: Call this tool once, passing an ARRAY of all tasks\n\n EXAMPLES:\n User Intent Based:\n - User: 'get weather and tell me a joke' → Sequential (2 separate tool calls, 1 task each)\n - User: 'get weather and joke in parallel' → Parallel (1 tool call with array of 2 tasks)\n - User: 'run these simultaneously' → Parallel (1 tool call with task array)\n - User: 'do task A then task B' → Sequential (2 separate tool calls)",
parameters={
"type": "object",
"properties": {
"execution_mode": {
"type": "string",
"enum": ["sequential", "parallel"],
"default": "sequential",
"description": "Execution strategy for multiple tasks. Use 'sequential' (default) unless user explicitly requests parallel execution with words like 'parallel', 'simultaneously', 'at the same time', or 'concurrently'.",
},
"task_ids": {
"type": "array",
"items": {
"type": "string",
"description": "Unique identifier for the task",
},
},
},
"required": ["task_ids"],
},
),
),
],
tool_choice=None,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment