@promptbook/utils
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
59 lines (58 loc) • 2.28 kB
TypeScript
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
import type { string_javascript_name } from '../../types/string_person_fullname';
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
/**
* USE BROWSER commitment definition
*
* The `USE BROWSER` commitment indicates that the agent should utilize browser tools
* to access and retrieve up-to-date information from the internet when necessary.
*
* This commitment provides two levels of browser access:
* 1. One-shot URL fetching: Simple function to fetch and scrape URL content
* 2. Running browser: For complex tasks like scrolling, clicking, form filling, etc.
*
* The content following `USE BROWSER` is an arbitrary text that the agent should know
* (e.g. browsing scope or preferred sources).
*
* Example usage in agent source:
*
* ```book
* USE BROWSER
* USE BROWSER Prefer official documentation and source websites.
* ```
*
* @private [🪔] Maybe export the commitments through some package
*/
export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition<'USE BROWSER'> {
constructor();
/**
* The `USE BROWSER` commitment is standalone.
*/
get requiresContent(): boolean;
/**
* Short one-line description of USE BROWSER.
*/
get description(): string;
/**
* Icon for this commitment.
*/
get icon(): string;
/**
* Markdown documentation for USE BROWSER commitment.
*/
get documentation(): string;
/**
* Gets human-readable titles for tool functions provided by this commitment.
*/
getToolTitles(): Record<string_javascript_name, string>;
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
/**
* Gets the browser tool function implementations.
*
* This method automatically detects the environment and uses:
* - Server-side: Direct scraping via fetchUrlContent (Node.js)
* - Browser: Proxy through Agents Server API via fetchUrlContentViaBrowser
*/
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
}