# Agent Code

## Agent

{% tabs %}
{% tab title="Schema" %}

```javascript
{
  type: "Agent",
  id: String!,
  name: String!,
  classification: String!,
  image: String,
  primaryLocation: Location,
  note: String
}
```

{% endtab %}

{% tab title="Example" %}

```javascript
{
  type: "Agent",
  id: "503",
  name: "Maro Horta",
  classification: "Person",
  image: "https://picsum.photos/200/300"
}
```

{% endtab %}
{% endtabs %}

**Notes**\
\&#xNAN;*Classification* is "Person" or "Organization".\
\&#xNAN;*Also might want at some point*\
user-defined relationships with other agents (such as membership, sub-groups, etc)

## AgentRelationship

{% tabs %}
{% tab title="Schema" %}

```javascript
{
  type: 'AgentRelationship',
  subject: Agent!,
  object: Agent!,
  relationship: AgentRelationshipRole!    
}
```

{% endtab %}

{% tab title="Example" %}

```javascript
{
  type: 'AgentRelationship',
  subject: Agent!,
  object: Agent!,
  relationship: AgentRelationshipRole!    
}
```

{% endtab %}
{% endtabs %}

## AgentRelationshipRole

{% tabs %}
{% tab title="Schema" %}

```javascript
{
  type: 'AgentRelationshipRole',
  label: String!,
  reverseLabel: String!
}
```

{% endtab %}

{% tab title="Example" %}

```javascript
{
  type: 'AgentRelationshipRole',
  label: String!,
  reverseLabel: String!
}
```

{% endtab %}
{% endtabs %}

## **Economic Event**

\
EconomicEvent is the minimum needed for recording work and distribution. EconomicEvent and Agent, plus the taxonomy, would be enough to provide a lot of the information needed for stats and accounting, if every app could provide just those.

{% tabs %}
{% tab title="Schema" %}

```javascript
{
  type:  'EconomicEvent',
  provider: Agent!,
  receiver: Agent,
  action:  String!,
  affectedQuantity: {
    quantity: Decimal!,
    unit: String!
  },
  date: String!,
  resourceClassifiedAs: ResourceClassification!,
  note: String,
  scope: Agent
}
```

{% endtab %}

{% tab title="Example" %}

```javascript
{
  type:  'EconomicEvent',
  provider: {
    type: "Agent",
    id: "503",
    name: "Maro Horta",
    classification: "Person",
    image: "https://picsum.photos/200/300"
  },
  receiver: {
    type: "Agent",
    id: "239",
    name: "OpenCoopWork",
    classification: "Organization",
    image: "https://picsum.photos/200/300"
  },
  action:  "write",
  affectedQuantity: {
    quantity: 123.00,
    unit: "words"
  },
  date: "2017-09-05",
  resourceClassifiedAs: ResourceClassification!,
  note: "Dude you're getting a telescope",
  scope: {
    type: "Agent",
    id: "239",
    name: "OpenCoopWork",
    classification: "Organization",
    image: "https://picsum.photos/200/300"
  }
}
```

{% endtab %}
{% endtabs %}

**Notes**

* ResourceClassification will be a taxonomy item from the taxonomy that is chosen by FairCoop to be used across apps.  Right now CE is working on unifying the taxonomy, including skills.
* unit at some point will probably be from a list, instead of a string, so that units can be normalized across apps.
* action is "work" or "give", to cover just the requirements of work events and income payment events.  There are other actions for when resources are being created or transported (meaning there is a Process in addition to EconomicEvents), like "use", "consume", "produce", and others.

*Also might want at some point*

**affects:** this is an EconomicResource, and used when something identifiable is involved, which could be a material or digital item that is recorded in inventory, or an account, say a FairCoin account) **fulfills:** this is a Fulfillment of an Intent, or part of a plan, that is fulfilled completely or partially by the economic event) - this would connect the plan to the work, and also add a piece of we would need to know what payment was done for what work (what work is already paid)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://oce.gitbook.io/docs/vocabulary/agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
