diff • AI Agent SDK

diff: Get file diffs from autonomous execution.

diff

Method

</div>

This is a method of the Agent class in the agent module.

Get file diffs from autonomous execution.

Returns a list of :class:FileDiff objects showing what files were modified, with additions/deletions counts.

Signature

python
def diff(from_hash: Optional[str]) -> Any

Parameters

ParamField Optional[str]

Base commit hash to diff from. If None, uses the first snapshot (pre-autonomous state).

Returns

ResponseField Any

:

agent = Agent(autonomy=”full_auto”) result = agent.start(“Refactor utils.py”) for d in agent.diff(): print(f”&#123;d.status&#125;: &#123;d.path&#125; (+&#123;d.additions&#125;/-&#123;d.deletions&#125;)”)

Uses

  • diff
  • logger.debug

Used By

Source

View on GitHub

praisonaiagents/agent/agent.py at line 4507