Patch Generation Scaffold¶
Source: agent_library/agents/patch_agent
What This Agent Does¶
A minimal scaffold you can copy when starting a new agent. Its "task" is to call bash_tool_main and echo "Hello, world!"; nothing more. There is no production workload here; the value is in the skeleton: a correct mk_agent signature, a real OpenSageAgent instantiation, and the minimum set of imports you need to grow from.
Use this when you want the shortest possible starting point that still resembles the other production agents in this directory: same mk_agent(opensage_session_id: str) entry, same OpenSageAgent(...) call, same single-tool wiring. From here you iterate by swapping the instruction, adding tools, and layering on sub-agents/ensembles as the task demands.
Full Source¶
from google.adk.models.lite_llm import LiteLlm
from opensage.agents.opensage_agent import OpenSageAgent
from opensage.toolbox.general.bash_tool import bash_tool_main
def mk_agent(opensage_session_id: str):
return OpenSageAgent(
name="patch_generation_agent",
model=LiteLlm(model="anthropic/claude-opus-4-7"),
description="Generates Python patch scripts for vulnerabilities.",
instruction="""
You are a dummy agent. You should use bash_tool_main to echo "Hello, world!" and get the output.
""",
tools=[bash_tool_main],
)
That's the whole file. The name hints at an eventual vulnerability-patching workload, but the shipped version is intentionally a stub.
Run It¶
No config file is shipped; the agent picks up the built-in default from src/opensage/templates/configs/default_config.toml.
How to Turn It into Something Real¶
- Swap the instruction with your task description and rules.
- Add tools. Useful starting points:
view_file,str_replace_edit: file ops (imports).run_terminal_command+ friends: bash access.finish_task: explicit termination.create_subagent,call_subagent,list_subagents: dynamic sub-agents.get_available_models: delegate to a specific model viacall_subagent(model_name=...).
- Add a
config.tomlif the default sandbox/LLM/history settings are not enough. - Enable skills (
enabled_skills=["retrieval", …]) if you want the bundled bash-tool scripts.
See any of the other agents in this section for complete examples of each step.