You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/oss/langchain/agents.mdx
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -529,6 +529,29 @@ const result = await agent.invoke(
529
529
For more details on message types and formatting, see [Messages](/oss/langchain/messages). For comprehensive middleware documentation, see [Middleware](/oss/langchain/middleware).
530
530
</Tip>
531
531
532
+
## Invocation
533
+
534
+
You can invoke an agent by passing an update to its [state](/oss/langgraph/graph-api#state). All agents include a [sequence of messages](/oss/langgraph/use-graph-api#messagesstate) in their state; to invoke the agent, pass a new message:
535
+
536
+
:::python
537
+
```python
538
+
result = agent.invoke(
539
+
{"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}
540
+
)
541
+
```
542
+
:::
543
+
:::js
544
+
```typescript
545
+
awaitagent.invoke({
546
+
messages: [{ role: "user", content: "What's the weather in San Francisco?" }],
547
+
})
548
+
```
549
+
:::
550
+
551
+
For streaming steps and / or tokens from the agent, refer to the [streaming](/oss/langchain/streaming) guide.
552
+
553
+
Otherwise, the agent follows the LangGraph [Graph API](/oss/langgraph/use-graph-api) and supports all associated methods.
0 commit comments