ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: "Output Format"
|
||||
description: ""
|
||||
icon: "arrow-right-to-bracket"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
## Agent History
|
||||
|
||||
The `run()` method returns an `AgentHistoryList` object with the complete execution history:
|
||||
|
||||
```python
|
||||
history = await agent.run()
|
||||
|
||||
# Access useful information
|
||||
history.urls() # List of visited URLs
|
||||
history.screenshot_paths() # List of screenshot paths
|
||||
history.screenshots() # List of screenshots as base64 strings
|
||||
history.action_names() # Names of executed actions
|
||||
history.extracted_content() # List of extracted content from all actions
|
||||
history.errors() # List of errors (with None for steps without errors)
|
||||
history.model_actions() # All actions with their parameters
|
||||
history.model_outputs() # All model outputs from history
|
||||
history.last_action() # Last action in history
|
||||
|
||||
# Analysis methods
|
||||
history.final_result() # Get the final extracted content (last step)
|
||||
history.is_done() # Check if agent completed successfully
|
||||
history.is_successful() # Check if agent completed successfully (returns None if not done)
|
||||
history.has_errors() # Check if any errors occurred
|
||||
history.model_thoughts() # Get the agent's reasoning process (AgentBrain objects)
|
||||
history.action_results() # Get all ActionResult objects from history
|
||||
history.action_history() # Get truncated action history with essential fields
|
||||
history.number_of_steps() # Get the number of steps in the history
|
||||
history.total_duration_seconds() # Get total duration of all steps in seconds
|
||||
|
||||
# Structured output (when using output_model_schema)
|
||||
history.structured_output # Property that returns parsed structured output
|
||||
```
|
||||
|
||||
See all helper methods in the [AgentHistoryList source code](https://github.com/browser-use/browser-use/blob/main/browser_use/agent/views.py#L301).
|
||||
|
||||
## Structured Output
|
||||
|
||||
For structured output, use the `output_model_schema` parameter with a Pydantic model. [Example](https://github.com/browser-use/browser-use/blob/main/examples/features/custom_output.py).
|
||||
Reference in New Issue
Block a user